Re: preg_match problem

From: Date: Sat, 20 Jan 2007 16:37:52 +0000
Subject: Re: preg_match problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-247456@lists.php.net to get a copy of this message
Double slash to prevent PHP interpreting the slashes. Also using single quotes would be a good idea: if (preg_match('/[\\w\\x2F]{6,}/',$a)) 2007/1/19, Németh Zoltán <znemeth@alterationx.hu>:
Hi all, I have a simple checking like if (preg_match("/[\w\x2F]{6,}/",$a)) as I would like to allow all "word characters" as mentioned at http://hu2.php.net/manual/hu/reference.pcre.pattern.syntax.php plus the '/' character, and at least 6 characters. But it throws Warning: preg_match(): Unknown modifier ']' and returns false for "abc/de/ggg" which string should be okay. If I omit the "\x2F", everything works fine but "/" characters are not allowed. Anyone knows what I'm doing wrong? Maybe "/" characters can not be put in patterns like this? Thanks in advance, Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#247456) next »