You are here: Re: [PHP] Regex help « PHP « IT news, forums, messages
Re: [PHP] Regex help

Posted by kjohnson on 01/29/05 23:58

Michael Sims wrote:

>> I need a validation regex that will "pass" a string. The string can
>> be no longer than some maximum length, and it can contain any
>> characters except two consecutive ampersands (&) anywhere in the
>> string.

>Yup, use this perl regex:
>
> /^(?:(&)(?!&)|[^&]){1,5}$/

[snip]

>Hope this helps you (pass your exam? ;) )


Thanks, Michael! I guess it is time for me to go review those zero-width
negative look-ahead assertions - don't know how I missed them ;)

And no, not an exam - this is real life. My days as a frolicking schoolboy
are quite some distance behind me ;)

Kirk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация