for a simple question I would prefer a simple solution (maybe not so perfect but easy to understand also to non-regexperts). This does exactly "match y or yes in case-insensitive manner":
while(<>) { print "yes\n" if /(y|yes)/i; }
update: above will match everything with a 'y' inside as ikegami observed. Below code does what I meant (this time tested before posting)
foreach (qw( YES YE Y yes ye y ys es s e Yeeessseeseeesssssess)){ print "$_ = yes\n" if /^(y|yes)$/i; }
In reply to Re: conditional regex
by BrimBorium
in thread conditional regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |