Re: preg_match problem

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

 



Beauford wrote:
You need to escape that forward slash in the character class:

         preg_match("/^[A-Za-z0-9!@#$%&()*;:_.'\/

Also, you've got only two backslashes in your char class. PHP is reducing this to a single backslash before the space character. I think you intend this to be two backslashes in the pattern so you need four backslashes in PHP:

         preg_match("/^[A-Za-z0-9!@#$%&()*;:_.'\/\\\\ ]+$/", $string)

On top of this, every time a ' is entered it gets preceded by \. If I just
check for the characters like below that doesn't happen. Totally confused.

if(preg_match("/^[-A-Za-z0-9_.' ]+$/", $string)) {

check out magic_quote_gpc??

use the funciton "get_magic_quotes_gpc()" to determine if it is on and run stripslashes() on the value if you find that it is on.

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree.

- Rush

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