ereg question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi all

can anyone tell me, does this condition evaluate to true or false?

$foo = ereg('ca?t', 'caaaaaaat');



Re: ereg question

Quoted text here. Click to load it

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

To match 'cat' or 'ct':

To match 'cat', 'caat','caaat' etc.

To match 'ct','cat', 'caat','caaat' etc.
-- =

Rik Wasmus

Re: ereg question

Regex reference:
It basic but it works.

'ca?t' translated in to English:

find the string 'ct' or 'cat'

? - match 1 or 0 occurrences

+ - match 1 or more occurrences 'cat' ''

* - match 0 or more occurrences 'ct'  'cat' ''

There is more but see the link above.

Re: ereg question

If you're looking to interactively test regex, why not use something  
like Regex Coach?

Very good tool. I can't live without it. Windows only though, as far  
as I know.

On Jan 26, 2:01 pm, wrote:
Quoted text here. Click to load it

Site Timeline