We are working on a project where we want users to be able to use both emoji syntax (like :smile:
, :heart:
, :confused:
,:stuck_out_tongue:
) as well as normal emoticons (like :)
, <3
, :/
, :p
)
I'm having trouble with the emoticon syntax because sometimes those character sequences will occur in:
- normal strings or URL's - http
:/
/example.com
- within the emoji syntax -
:p
encil:
How can I find these emoticon character sequences but not when other characters are near them?
The entire regex I'm using for all the emoticons is huge, so here's a trimed down version:
(:)|:(|<3|:/|:-/|:||:p)
You can play with a demo of it in action here: http://regexr.com/3a8o5
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…