regexp problem, a little strange
Posted: Tue Aug 12, 2008 11:56 am
Hi to all,
i need to solve a problem with a regular expression but so far i don't get a solution for that.
I need to obtain, in a string, all the occurrences between ' ' , but ignoring something like \' in the middle.
Practical example:
So, in this case, i want to ignore that \' .. my result array must be
covering multiline too.
i don't want to get, and this is what i get with my current reg exp.
My (best) current reg exp to do that :
I have tried with assertion too, but i made some mistake and it doesn't go well
Any help would be appreciated!!
Alessandro
i need to solve a problem with a regular expression but so far i don't get a solution for that.
I need to obtain, in a string, all the occurrences between ' ' , but ignoring something like \' in the middle.
Practical example:
Code: Select all
$str = "this is a ' test for my regexp. i have
something called \'Something\', but i don't want
to check that quotes'. so 'on' etc..";
Code: Select all
0 => 'test for my regexp. i have something called \'Something\', but i don't want
to check that quotes
1 => 'on'i don't want to get
Code: Select all
0 => 'test for my regexp. i have something called \'My (best) current reg exp to do that :
Code: Select all
preg_match_all("/'[^']+'/s", .., ...);Any help would be appreciated!!
Alessandro