On Fri, 28 Feb 2003, Stefan Lidman wrote:

> > Note that you'll match on dudette and joeshmoe ... if you want an exact
> > match, you could do:
> > 
> > print "$_\n" if (/^joe|dude$/);
> 
> I guess you ment:
> 
> print "$_\n" if (/^(?:joe|dude)$/);
> 
> Otherwise it matches if it begins with 'joe' or ends
> with 'dude'.

Whoops, yes thanks for catching that!

Note for regex newbies that the ?: means that the ( ) around joe|dude is
unmarking;  that is to say, the results will NOT be captured in $1, unlike
/^(joe|dude)$/. In this case, we can do it either way, but we don't need
to capture anything in the regex, hence the reason why Stefan put that in.

Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to