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 Link to comment https://forums.phpfreaks.com/topic/218521-need-regular-expression/ 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) ? Link to comment https://forums.phpfreaks.com/topic/218521-need-regular-expression/#findComment-1133619 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); Link to comment https://forums.phpfreaks.com/topic/218521-need-regular-expression/#findComment-1133629 Share on other sites More sharing options...
BlueSkyIS Posted November 12, 2010 Share Posted November 12, 2010 preg_match_all() Link to comment https://forums.phpfreaks.com/topic/218521-need-regular-expression/#findComment-1133644 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.