You've got one trailing backslash at the end too many - it should be:
Code:
(.*)\\\\u003c\\\\\\/a>
In the above there are six \ before the /a>, in your example, you've got seven.
That being said, what in the world are you trying to do because, unless you are just practicing your regexp skills, I doubt that this is a good way of solving your problem.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
You have to add a slash to every escaped special character, which are:
! @ # $ % ^ & * ( ) + = - [ ] \ ' ; , . / { } | " : < > ? ~ _
Which could be done with an addslashes function
Code:
function addslashes (str) {
return str.replace(/[!@#\$%\^&\*\(\)\+=-\[\]\\';,\.\/\{\}\|":<>\?~_]/g, '\\$&');
};
There a catch though.
In your String: \;:[]}}\\\">\\Green Apple\\u003c\\\/a>\\u003c\\\/div>
you have escaped special character: ; \ " /
but you also have unescaped special character: : [ ] } >
Those unescaped ones should't have a slash added, so they shouldn't be added to the 'addslash' function.
To be save, here is a function which only add slashes to the escaped characters in your string.
But I can't guarantee it works correct on every string you might have.
Do you want to post what you're actually trying to do rather than solving this one problem for this one string, because chances are you'll be back once you come across another one.
All that being said, the solution I posted in post #3 in this thread is the answer to your original question...one too many trailing backslashes in your regexp....but again, the probably won't help you if your actual problem is more complicated than just having to match this one specific type of string.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
Bookmarks