You are here: Re: ereg question « PHP Programming Language « IT news, forums, messages
Re: ereg question

Posted by Rik on 01/26/07 19:51

monomaniac21 <mcyi2mr3@googlemail.com> wrote:

> hi all
>
> can anyone tell me, does this condition evaluate to true or false?
>
> $foo =3D ereg('ca?t', 'caaaaaaat');

False afaik. Forget the POSIX functions, use preg_match();

To match 'cat' or 'ct':
preg_match('/ca?t/',$string);

To match 'cat', 'caat','caaat' etc.
preg_match('/ca+t/',$string);

To match 'ct','cat', 'caat','caaat' etc.
preg_match('/ca*t/',$string);
-- =

Rik Wasmus

 

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

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