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