Re: Re: eregi problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kim Madsen wrote:

-----Original Message-----
From: andreja@xxxxxxxxxxxxxx [mailto:andreja@xxxxxxxxxxxxxx]
Sent: Sunday, April 03, 2005 6:03 PM
To: php-general@xxxxxxxxxxxxx
Subject:  Re: eregi problem

i'm not familliar with regular expresions but i think that  ^a-z - means
that variable must start witx a-z characters
you can chek it  here:

http://www.php.net/manual/en/reference.pcre.pattern.syntax.php


True, but look careful at what HE did:


if((eregi("[^a-zA-Z0-9]",$GP[sifre])


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 =/

Also there´s no idea in having a-zA-Z in the pattern since eregi() is case insensitive.


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux