in reply to quick question about parenthesis and regular expressions
Perhaps you wish to investigate some anchors (namely ^ and $). Also of interest might be (besides the manual pages) YAPE::Regex::Explain.for my $word ( qw[ absorb absorbo absorbs absorbed absorbarararara ]){ $word =~ /(absorb|absorbs|absorbed)/i and warn " $1 "; } __END__ absorb at - line 2. absorb at - line 2. absorb at - line 2. absorb at - line 2. absorb at - line 2.
update: Enlils response reminded me of Regex::PreSuf
use Regex::PreSuf; my $re = presuf(qw(absorb absorbs absorbed absorbing )); die $re; __END__ absorb(?:ed|ing|s)? at - line 3.
|
|---|