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+))/';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.