Match smilies without spaces in WordPress

I know, it’s dumb, but I think it’s annoying that when someone enters a smiley manually like this hi:) it will not be detected and converted by WordPress because WordPress smilies functions looks for spaces and require a space before and after the smiley replacement.

I searched but I couldn’t find a helpful topic about this, does anyone have any workaround for this? Like automatically replacing smilies text with [space]:)[space] upon post/comment post so it would be detected?

Read More

Here’s WordPress expression to match smilies:

/((?:s|^)|(?:_|)(?=s|$))|((?:s|^)x(?:D)(?=s|$))|((?:s|^)o(?:_O)(?=s|$))|((?:s|^)^(?:^’|^‘|^'|^’)(?=s|$))|((?:s|^)X(?:D)(?=s|$))|((?:s|^)O(?:_o)(?=s|$))|((?:s|^)>(?::D|:(|-I)(?=s|$))|((?:s|^)=(?:^-^=)(?=s|$))|((?:s|^)<(?:3)(?=s|$))|((?:s|^);(?:-)|))(?=s|$))|((?:s|^):(?:’(|‘(|||x|wink:|whiterussian:|twisted:|star:|smile:|shock:|sad:|roll:|razz:|p|oops:|o|neutral:|mrgreen:|martini:|mad:|lol:|idea:|heart:|grin:|facepalm:|evil:|eek:|developer:|cry:|cool:|burrito:|bear:|arrow:|\|X|P|O|D|???:|?:|?|/|-||-x|-p|-o|-\|-X|-P|-O|-D|-?|-/|-)|-(|)|(|'(|’(|!:)(?=s|$))|((?:s|^)8(?:O|-O|-))(?=s|$))|((?:s|^)((?:w)|W))(?=s|$))|((?:s|^)&(?:lt;3|gt;:D|gt;:(|gt;-I)(?=s|$))/m

Related posts

Leave a Reply

1 comment