Reputation: 196
I currently have the following action script regular expression (cut down for readability):
private var _emoticonRegEx:RegExp = /(:[)|\(thumbsup\)|<3|O_O)/g;
This is used to match strings in a chat tool and replace with various emoticons.
For example if a user enters <3 it is replace with a heart emoticon.
All string are matched except "O_O" regardless of its positioning in the regexp string.
Does anyone have any ideas as to why the string 'O_O' specifically is not matched?
Upvotes: 2
Views: 122
Reputation: 46
\:\[\)|\(thumbsup\)|<3|O_O.
You forgot screening operation for symbols: [,),:.
Upvotes: 0
Reputation: 196
It seems this is what i was after:
/(:\[|\(thumbsup\)|<3|O_O)/g;
Needed to remove the closing bracket from the first :[ and escape the [ (Thanks Jerry)
Upvotes: 2