Jasper McCrea wrote:
> 
> 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.
> 

Never mind, I was confused, as usual. I didn't think it could possibly be
working as (I thought it was) intended.

But it sort of proves the point, anyway, in that Mr Peterson wrote his regexp
wrong.

If he didn't mean

/^\s*(y|ok)/i

I apologise.

Jasper
-- 
$"='';{split//,"ajpsa onhtrep re lahkcre"}foreach(0..$#_){
unless($_%2){$_[$_]^=$_[++$_]^=$_[--$_]^=$_[++$_]}}print"@_\n"

Reply via email to