Jump to content

Need Regular expression


piyush23424

Recommended Posts

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

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.