laziness, impatience, and hubris | |
PerlMonks |
Re: Retrieving specific word from a line of text.by impossiblerobot (Deacon) |
on Dec 11, 2002 at 16:48 UTC ( [id://219122]=note: print w/replies, xml ) | Need Help?? |
To answer your question, you need to use capturing parentheses. Additionally, the leading and trailing .*s are unnecessary.
The part of the regex matched within the parentheses will end up in $1. See perlre for more details. Updated: Added link to perldocs, and decided to assume that he wanted an entire word, rather than a single word character. Impossible Robot
In Section
Seekers of Perl Wisdom
|
|