0

I have the following Regex expression:

(?<=>[^<]*)(abc)

The idea behind the expression (I think) is to find any instance of the letters abc, or whatever the user search for, that are not in any tag.

See the example: https://regex101.com/r/bsNFne/2 (only works in Chrome)

The problem is that positive lookahead is not supported in Internet Explorer or Edge.

I have attempted different conversions, but I cannot find a Regex that works in Internet Explorer and achieves the same result as the above regex in Chrome.

How can I convert the regex to function in all major browsers?

MortenGR
  • 803
  • 1
  • 8
  • 22
  • 1
    Only way right now (for JavaScript outside of Chrome) is to use a capture group `(>[^<]*)(abc)` but you should probably use an XML parser, since that's what it looks like you're trying to parse: [see here](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – ctwheels Mar 08 '18 at 15:09
  • Good thinking! However, this only seems to function when there's at least one tag, what if the user just typed abc? Maybe I could just add a content tag somewhere, or maybe there's a more elegant solution? – MortenGR Mar 08 '18 at 15:35

0 Answers0