Skype smileys REGEXP patterns where/how to get?

拟墨画扇 提交于 2019-12-04 14:31:22

问题


I would like to understand the patterns they are using for their smileys.


回答1:


If emoticons are only replaced if surrounded by whitespace or (presumably) at start/end of a line/string, then you can use a series of regexes.

Using this list (taken from http://www.skype-forum.com/ftopic13197.html),...

you can construct these like this:

(?<=^|\s)<<smiley regex>>(?=\s|$)

will match <<smiley regex>> only if it's on its own.

Examples for <<smiley regex>>:

:-?\)    :-?\(       :-?D         8\)
;\(      \(sweat\)   :\|          :\*
:\$      :\^\)       \|-\)        \|\(
;\)      \]:\)       \(talk\)     \(yawn\)
\(doh\)  :@          \(wasntme\)  \(party\)

etc. - you'll need to escape a lot of special-meaning characters for use in a regex. Your language might have a re.escape() function for this.



来源:https://stackoverflow.com/questions/5077842/skype-smileys-regexp-patterns-where-how-to-get

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!