I’ve imported an old guestbook into drupal, but some smilies from old system will be deleted, so I need to delete it from my content string
smilies example: :lol: :nice: ...
as you can see all of them are inside : without spaces, this is my code but have some issues with spaces.
preg_match_all( '/\:(.*?)\:/', $string, $matches );
string example: :p hello to everybody :lol:
return :p hello to everybody :
So, I need to remove only the :?:
Any ideas to make it work?
/\:(\w+)\:/or/\:([^\s]+)\:/ps: not sure that you have to escape colons and you do not need parenthesis here, but it is up to you 🙂