$nw=ereg_replace('[a-z0-9 ]','',$w);
I added a space after the 9 on my expressions and it worked BUT it also caused an unseen problem. It allows your $nw to BEGIN with a space or END with a space and IF (like me) you are storing this in a mysql database that can cause havok if it is duplicate names with just space differences. You need to write the expression to allow ONLY alphanumeric at the start and end, with whitespace in the middle if that is a problem. If you need that code, lemme know and I will go dig it up. 🙂 (as always, Kirk or Brandon may know a better way. 🙂)
Zevious wrote:
I have this:
$nw=ereg_replace('[a-z0-9]','',$w);
This works to strip out the non-alphanumeric characters but also strips the whitespace. How can I keep the spaces?
TIA!