Prateek Narendra
Prateek Narendra

Reputation: 1937

Matching Regular Expression of Emoticons

I have a regex in Ruby to match a huge list of emoticons

/\|?>?[:*;Xx8=<(%)D]-?'?,?o?\_^?[-DOo0S*Ppb3c:;\/\\|)(}{\]><]\)?/

But it doesnt match a few emoticons like

:'-( 

and

:*(

The link with my set of matching emoticons is http://rubular.com/r/1vnWEvN76v

How do I match the unmatched ones ?

Upvotes: 0

Views: 132

Answers (1)

Kasravnd
Kasravnd

Reputation: 107347

use r":'-\(" for first example and r":\*\(" for second . and you can add them with pipe (|) to your regex ! but its depend on what you want to be matched with your regex , also you can add them after other regexes or use & or ..

Note that ( and * are regex symbols and you need \ before them !

in this case for your regex you just need to add |\( end of your regex:

\|?>?[:*;Xx8=<(%)D]-?'?,?o?\_^?[-DOo0S*Ppb3c:;\/\\|)(}{\]><]\)?|\(

Upvotes: 1

Related Questions