RE: preg_match problem

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

 



Not a big regex expert, but first off i would recommend not using / as a
delimiter for your pattern if you are trying to catch forward slashes in
your text.

I would use a pattern like:

#[a-zA-Z0-9/]{6,}#


Regards,

Tim

> -----Message d'origine-----
> De : Németh Zoltán [mailto:znemeth@xxxxxxxxxxxxxx]
> Envoyé : vendredi 19 janvier 2007 15:26
> À : php-general@xxxxxxxxxxxxx
> Objet :  preg_match problem
> 
> 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

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