Re: Trying to remove bad charactors.
| From: | Jason Wong | Date: | Mon, 28 Jan 2002 03:07:11 +0000 |
| Subject: | Re: Trying to remove bad charactors. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82352@lists.php.net to get a copy of this message | ||
On Monday 28 January 2002 06:24, Philip J. Newman wrote:
> I'm trying to replace !@#$%^&*() with nothing how ever every thing that I
> try it takes out the space too which is bad. Siggestions
>
> $q=preg replace("!","",$q);
Use str_replace(). Only use preg() and friends *IF* you need to search for
regular expressions.
$q = str_replace(array('!', '@', '#'), '', $q);
Also, please do not cross-post.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Slow day. Practice crawling.
*/