Re: Re: Arrrr The Space is gone.

From: Date: Sun, 27 Jan 2002 05:23:46 +0000
Subject: Re: Re: Arrrr The Space is gone.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-82270@lists.php.net to get a copy of this message
This returns an error $q=preg replace("/[^ \w]/","",$q); Parse error: parse error in d:\hosting\http\philipsdomain\config.php on line 41 Suggestions? ----- Original Message ----- From: "CC Zona" <email@cczona.com> To: <php-general@lists.php.net> Sent: Sunday, January 27, 2002 6:15 PM Subject: [PHP] Re: Arrrr The Space is gone. > In article <002801c1a6ed$1a9c10a0$0401a8c0@philip>, > newmanpj@philipsdomain.com (Philip J. Newman) wrote: > > > $q=preg replace("/[ \W]/","",$q); > > > > I have this to remove all the bad things, but it takes out the space to ... > > )o; why? > > There's a space in your character class, so of course it will be among the > characters matched/replaced. But merely deleting it from the character > class doesn't solve the problem either, since a space character also meets > the criteria for "not a word character" (\W). If the objective is to strip > all characters that are neither a space nor a "word" (a-zA-Z0-9_), then try: > > $q=preg replace("/[^ \w]/","",$q); > > -- > CC > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#82270) next »