> -----Original Message-----
> From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 04, 2005 3:08 PM


> > Putting the ^ _inside_ [] means NOT, so if any of the chars a-z0-9 is in
> the string itīs NOT matched.

> actually, that's not entirely correct. The regexp basically means that
> if there is any character in the string which is NOT alphanumeric, then
> it is matched. So basically it returns true if there is a
> non-alphanumeric char, and false otherwise. However, AFAIK the regexp
> should be delimited, since if it isn't it behaves "differently"... I
> just can't remember how differently it is exactly =/

It _is_ correct. [^] means that whatever is in the [] must not be in the 
checked var to be true! Look in "mastering regular expressions" if Youīre in 
doubt. Thereīs an example [^1-6] meaning if a digit between 1 and 6 is not in 
the value checked, itīs true:

$var1 = "123";
$var2 = "789";

if(ereg("[^1-6]", $var1))
  print "$var1 is true";
else
  print "$var1 is false";

returns false

if(ereg("[^1-6]", $var2))
  print "$var2 is true";
else
  print "$var2 is false";

returns true

Itīs untested though :-)

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to