# [EMAIL PROTECTED] / 2007-01-19 15:25:38 +0100:
> 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?
1. You're making your life harder with those double quotes. \x2F is
interpolated by PHP, before the PCRE library has a chance to see the
string.
2. Use a different delimiter and you'll be able to use slash characters
in the pattern freely.
preg_match('~[\w/]{6,}~', $a);
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php