Hi Jason,

@ 3:08:06 AM on 4/20/2001, Jason Caldwell wrote:

> Sorry if I seem dense.  Your answer (although probably right on target)
> leaves me still confused :-)

No problem at all.

> The example you gave me:

> $string = 'aaaa.aaaa';
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
> match');

> Now with your example (above) the following MATCHED (when, I think it
> shouldn't have:)

> (example 1)
> aaaa.a!

Matches because there is *at least* one alnum after the \.
It doesn't care about the ! as long as it found the a.

> aaaa.a#$%

Ditto here.

> aaaa.a23!%

Ditto here.

> The following did NOT match.

> (example 2)
> a!.aaaa

This didnt' match because of ^[[:alnum:]]+\.

There's a [:punct:] between the [:alnum:] and the \.

> a%!.aaaa

Ditto here.

> aaaa.!a34

No [:alnum:] after the \.

Your expression asks for *at least one* [:alnum:]

Changing + to * would make that match.

> Now when I took your example and added the $ at the end, like so:

> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)$", $string) ? 'matched' : 'no
> match');

> Everything that MATCHED in example 1 no longer matched,

Right, because it had a [:punct:] before the end of the string and you
forced it to only pick up [:alnum:]'s

-Brian
--
 PGP is spoken here: 0xE4D0C7C8
 Please, DO NOT carbon copy me on list replies.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to