regex - PHP codeigniter splitting string to array by regular expression -


i have text file , want split text array using regular expression. new regex , don't know how use it. text file format this:

0,"20"1,"100000050"25,"100000050"19,""11,"masuda"12,"jin" want split them like: 0: 0,"20" 1: 1,"100000050" 2: 25,"100000050" ... 

please help! answer appreciated!

use preg_split() function. operates split(), except regular expressions accepted input parameters pattern.

using preg_split_delim_capture returns parenthesized expression in delimiter pattern.

preg_split(   '/([\d]+,\"[0-9a-za-z]+\")/',   $str,   -1,   preg_split_delim_capture | preg_split_no_empty ); 

/([\d]+,\"[0-9a-za-z]+\")/ regular expression.

/ = start or end of pattern string [ ... ] = grouping of characters \d - digits + = 1 or more of preceeding character or group , = literal comma character \" = literal quote character [0-9a-za-z] = numbers , letters 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -