[PHP] Re: Arrrr The Space is gone.

2002-01-26 Thread CC Zona

In article 002801c1a6ed$1a9c10a0$0401a8c0@philip,
 [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Arrrr The Space is gone.

2002-01-26 Thread Philip J. Newman

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 PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, January 27, 2002 6:15 PM
Subject: [PHP] Re: A The Space is gone.


 In article 002801c1a6ed$1a9c10a0$0401a8c0@philip,
  [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Arrrr The Space is gone.

2002-01-26 Thread CC Zona

In article 004d01c1a6f2$cb909070$0401a8c0@philip,
 [EMAIL PROTECTED] (Philip J. Newman) wrote:

 This returns an error
 
 $q=preg replace(/[^ \w]/,,$q);
 
 Parse error: parse error in d:\hosting\http\philipsdomain\config.php on line
 41
 
 Suggestions?

I think ezmlm must strip underscores from messages, 'cuz a lot of posts 
(though, oddly, not all...) seem to be missing them from otherwise 
valid/functioning code.  The function is named preg_replace (an 
underscore between the words), not preg replace (with a space).

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]