[ACCEPTED]-preg_match "Compilation failed: missing )-preg-match

Accepted answer
Score: 14

This regex is insane. I have a hard time 7 believing you really need such a complicated 6 one.

In any case the problem is that PHP 5 is consuming the backslash for the PHP string. So 4 you have to escape all the backslashes with 3 another backslash.

And considering the number 2 of backslashes you already have you'll probably 1 go a little nuts doing it.

See also: Leaning toothpick syndrome

Score: 0

I agree that the regex looks ugly. To get 4 it to compile, though, you just need to 3 change both instances of




and both

But I 2 wouldn't trust this regex to work reliably. Too 1 many .*s for my taste.

More Related questions