Work wrote:
> 
> if($userinput =~ /^\s*y|(ok)/i) # nice
> {
> ...
> }
 
Going some way to prove that regexps are complicated (for me, anyway), this does
not do what I thought it would.

/foo|bar/ matches foo or bar, obviously.

/foo|(bar)/ (as in the yes/ok case above) matches totally different stuff.

Although I've only been using regexps for 4+ years, and don't remember seeing
this behaviour before. If I have seen it, I must have spurned it, thinking "I
must use parentheses better than that".

Jasper
-- 
We got Deathstar (Deathstar),
We got Deathstar (Deathstar),
We got Deathstar (Deathstar),
And you know that we got it.

Reply via email to