1

I got a regex in javascript for replacing emoticons code with emoticon images as they are typed in a contenteditable div. I'm using "negative lookbehind" to not replace http://, https:// and mailto: with emoticon images. This regex is working in opera and google chrome but, in firefox and edge the "negative lookbehind" future is giving errors.

So is there any way to rewrite this regex to work in all browsers? I want the emoticons to be replaced even if they don't have a whitespace in front of them like here:).

// My regex for the :/ emoticon icon

/(?<!http|https|mailto):\/|:-\//
Rajohan
  • 1,411
  • 2
  • 10
  • 27
  • 1
    No. Lookbehind is a recent new feature, and some browsers simply don't support it. There's nothing you can do to the regex. You will need to match, and then manually filter out those occurences that are preceded by a protocol. – Bergi Feb 24 '18 at 14:07

0 Answers0