Reputation: 697
Here's my Regex in C#:
(?<!\([\w\s]+)\bSWORD\b
I now need this in JavaScript. I'm a newbie to regex, so I have no idea how I would do this without the lookbehind. Any help would be appreciated.
Upvotes: 2
Views: 97
Reputation: 44259
Since you don't have a lookahead as well, there is a neat trick. Reverse the input string and apply the reversed regular expression:
\bDROWS\b(?![\w\s]+\()
If you want the position of the match in the actual input string, then you can find it as:
lengthOfInputString - (foundMatchPosition + lengthOfMatch)
Upvotes: 3