piyush23424 Posted November 12, 2010 Share Posted November 12, 2010 i want to extract the values enclosed with inverted commas(quotes) using regular expression. the string is $string = '"6467370","0","1047","","","","","","","","","" "000646737043","999010161661","s802853218509","Test Account","3","9.9500","02/04/2008","99","65","None","4 test test","",""'; reg. exp. should put the extracted values in a array thanks in advance. Thanks Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 12, 2010 Share Posted November 12, 2010 you must use regular expression? you can't just $an_array = explode(',',$string) ? Quote Link to comment Share on other sites More sharing options...
piyush23424 Posted November 12, 2010 Author Share Posted November 12, 2010 yes, you are right that only reg exp. can work here I had made a reg. exp for this but it extracts only first element from the string. here is the regular expression. pls, check if you know how to make it work to show all the matching values $pattern = "^\"(.*?)\"^"; preg_match($pattern, $string, $matches); print_r($matches); Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 12, 2010 Share Posted November 12, 2010 preg_match_all() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.