Reputation: 1176
Below is a regex which works fine in .net but give me error if I use it in PHP.
(?<=")([^"]+,[^"]+)?(?=")
What does this regex is supposed to return?
Input: 1,"x1",43,"tr","y,7"
It will return me "y,7"
in this case. In general, it will return any part between "
and "
if it has a comma between it.
When I try to use this in PHP, I get following error:
Unknown modifier '('
Please help.
Upvotes: 0
Views: 73
Reputation: 255015
~(?<=")([^"]+,[^"]+)?(?=")~
For php (preg_*
functions) you need to specify delimiter around the regex iteself. It can be !
, /
, #
, ~
, etc.
Upvotes: 2