View Single Post
Old 11th July 2008, 10:22
burschik burschik is offline
Junior Member
Join Date: May 2008
Posts: 24
Thanks: 0
Thanked 2 Times in 2 Posts

It would be a good idea to tell us what language you are using, since not all regular expression implementations are created equal and since that knowledge might enable us to point out an alternative solution that might be possible in one language and not in another.

I'm pretty sure, for example, that you can not do what you want to do with real regular expressions, although it might be possible with pcres. Since you seem to be using php, allow me to suggest the following alternative to your approach:

HTML Code:
$input = "1,2,4,'test,like,this,see',5,6,'resume,coding',7";
preg_match_all("/'[^']+'|[^,]+/", $input, $output);
foreach ($output[0] as $string) {
  echo $string . "\n";
Reply With Quote