I'm writing a system that will recognize smilies in a string. Because I have a whole bunch of smilies, using str_replace() ceases to be an option. I have to use one command that will look through the whole string for all the smilies at the same time. I guess preg_replace() would be my #1 option. The problem is, I know zero when it comes to regex, so any help is very much appreciated. I want to recognize smilies with or witiout a space between the smilie and the next character (and previous character) (for instance: "text =)", "text=)", "te=)xt" or "=)text", the :\ part should be recognized as a smilie. My smilie codes include ":eek", ":\", ";)", ":evil" and so fourth. I'm not asking for someone to "do it for me", but please show me how to do it for at least one or two smilies. I hope I'll be able to figure out the rest.
Thanks for the help.