Emoji typing regex messed up

Viewed 114

I'm building a simple chat with some basic emojis. So when the user for example types :), a smiley emoji is being displayed inside the input field.

However my regex fails when it comes to the emoji :/ and the reason is that it messes up URLs. (Keep in mind the emoji detection is triggered on keyup).

Example test text:

Hello could you please visit my website at http://www.example.com or https://www.example.com :/ ://

So to sum up the regex must not replace :/ when it starts with http or https.

Currently in my mapping I have this: "[^http?s]:/{1}(?!/)": "1F615" but for some strange reason it keeps 'eating the previous character upon replace'.

2 Answers
Related