Re: preg_match problem

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

 



At 1/23/2007 04:52 AM, Martin Alterisio wrote:
if (preg_match('/^[A-Za-z0-9!@#$%&()*;:_.'\\/\\\\ ]+$/', $string))


Close but no cigar. Because you're using apostrophe to quote the expression, PHP interprets the apostrophe inside the character class as ending the quoted expressions and fails. Both PHP and PREG need you to escape any character inside a string that's used to delimit the string itself.

(I think it's just as important to test the code we offer to solve problems on the list as it is to research problems before posting them. This is all getting archived....)

Regards,

Paul
__________________________

Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
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