cranberry13 has asked for the wisdom of the Perl Monks concerning the following question:
I have a quick question about using regular expresssions.
I want to match
$word =~ /absorb|absorbs|absorbed/i
and save the match in $1 (and supposing there can only be one match), how do I place the 'parenthesis'?
This doesn't work:
$word =~ /(absorb|absorbs|absorbed)/i
What am I doing wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: quick question about parenthesis and regular expressions
by Enlil (Parson) on Nov 04, 2003 at 09:58 UTC | |
by ysth (Canon) on Nov 04, 2003 at 10:15 UTC | |
by cranberry13 (Beadle) on Nov 04, 2003 at 12:31 UTC | |
by jreades (Friar) on Nov 04, 2003 at 13:32 UTC | |
by Roy Johnson (Monsignor) on Nov 04, 2003 at 18:08 UTC | |
by tilly (Archbishop) on Nov 04, 2003 at 18:49 UTC | |
|
Re: quick question about parenthesis and regular expressions
by PodMaster (Abbot) on Nov 04, 2003 at 09:55 UTC |