Jump to content

[SOLVED] Unexpected Error in Regex


d.shankar

Recommended Posts

Umm.. Because your code is quite broken, it's hard to tell what it is supposed to even match. It would be easier to tell how to fix it, if I even know what it is supposed to do.

 

But, I'm going to make a guess here:

 

Your regex is supposed to match different kind of character representations. If that is correct, then mostly your problem is simply the fact that you are not taking into account the fact that \\ will be converted into \ because it simply escapes the \ character in the string. Thus, you pretty much just have too few backslashes there. Here it is fixed:

 

$pattern='/((?:\\\\u00[a-f0-9]{2})|(?:\\\\x0*[a-f0-9]{2})|(?:\\\\\\d{2,3})|(?:\\W?=\\W?\\s*0x\\w+))/';

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.