I'm trying to find all appearance of smiley text ":D" which is not following after "mailto" The problem is that I'm trying to detect smileys in htmlText and sometimes it may be not correct example "mailto:Denis@email.com" smile pattern ":D" should not be matched when appear in email. This is the wrong example that I'm trying to implement: http://regexr.com/3a3at Somebody please help.
Javascript (what a shame!) doesn't support lookbehinds, therefore the most realistic option would be something like
input
.replace(/(mailto|https?):/g, "$1\x00")
.replace(/:D/g, "smile")
.replace(/\x00/g, ":")
Basically, replace "unwanted" colons with \x00
(or some other symbol that is unlikely to appear in the input), process smiles and then replace \x00
s back to colons.