Re: ereg_replace???
| From: | Shawn McKenzie | Date: | Mon, 28 Oct 2002 18:33:54 +0000 |
| Subject: | Re: ereg_replace??? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121764@lists.php.net to get a copy of this message | ||
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" <holmes072000@charter.net> 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...
>
>