0

Trying to use a simplified RegEx to solve a little emoji replacement.

regex is: ((?!http)(\:\/))

context is: Hello there, don't goto <a href="http://x.com">x.com</a>, they have bad service :/

Still captures both ":/"s in the context. I know there's the bracket non-capturing character method, but I couldn't find any modernized / simplified version of something like this.

Michael Mikhjian
  • 2,760
  • 4
  • 36
  • 51

1 Answers1

2

If you cannot use lookbehinds you may want to try and cleverly expand your match like I.e.

( :\/)

Note the extra space which could of course be something more sophisticated.

Update

(:\/)(?!\/)

did the trick by using a negative lookahead (which Javascript supports) for a /.

SGD
  • 1,676
  • 14
  • 18