javascript - Regex only detects the first emoticon? -


here regular expression using detect of emoticons in text:

/[\:][0-9a-za-z'\&\-\.\/()=:;]/.exec(" hi there:d :p") 

but detects first (:d)
problem?
in advance!

i'd suggest use .match() , regex global g flag:

"hi there:d :p".match(/[\:][0-9a-za-z'\&\-\.\/()=:;]/g); 

Comments