
PGScooter
stranger
Jun 12, 2008, 1:21 AM
Post #1 of 3
(7897 views)
|
capturing parentheses in subseraches
|
Can't Post
|
|
Hi, I know I've read this a couple of times, but forgot how it is correctly done. Suppose I do a regex search, condition on it and within that if block, I do another regex search. How do I refer to the capturing parentheses in the subsearch? Because don't $1,$2,... refer to the main search, not the nested one? if ($string=~/(\w*)end/) { if ($diffstring=~/$1five(\w*\d{2})/) { print "don't know"; #how do I get what's in (\w*\d{2})? } } thanks The more you teach me, the more I learn. The more I learn, the more I teach.
|