Click to See Complete Forum and Search --> : replacing characters without errors


notaguru
03-25-2005, 03:56 PM
Hi, on my bulleting board i have enable smileys like msn using:

$message = ereg_replace("\(N\)","<img src=\"30.gif\">",$message);

PROBLEM IS:

Too many people use more than one together like (y)(n)(o) etc etc i would like to put a SPACE between each one to prevent my layout to loose shape, i'll already use:

$message = ereg_replace(")(",") (",$message);

Since for me it's obvius that if ")(" is found just have to replace it with ") (" and voila a space is created but there's an error how can this be done without errors?

thanks.

phpnovice
03-25-2005, 04:17 PM
Since the parentheses are meaningful characters in Regular Expressions, perhaps you should escape them so that the Regular Expression treats them as normal characters.