![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Re^3: regex troubleby amir_e_a (Hermit) |
on Mar 05, 2010 at 07:11 UTC ( #826896=note: print w/replies, xml ) | Need Help?? |
Matching by itself only checks whether a string conforms to a pattern that you defined in the regular expression. You capture strings using brackets - ( ). If you have only one string to capture, then the way that almut suggested will work. If you have more than one string, you have several ways to capture them: First way:
Second way:
Third way - very readable, but will only work in Perl 5.10:
(You should probably pick better names that "part1" and "part2". I only gave them as an example.)
In Section
Seekers of Perl Wisdom
|
|