Thanks! Why does preg_replace("^\W^","",$str); not remove undescores _ ? Are they alpha-numeric?
I had to do this preg_replace("^\W|_^","",$str); TIA, Shawn "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:000201c27eab$f4ea0500$7c02a8c0@;coconut... > > I need to replace all NON alpha-numeric characters in a string. > > > > Example: > > input: "-What's Up Doc?" > > output: "WhatsUpDoc" > > > > I received this in a previous post, but it doesn't work: > > $str = ereg_replace("/[^[:alnum:]]/i", '', $str); > > Use preg_replace() with that string, not ereg_replace(). > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php