in reply to Re: Regex's, parentheses, and the mysterious ( ??{ } ) operator
in thread Regex's, parentheses, and the mysterious ( ??{ } ) operator
Laurent R: "the $stuff variable is not the same in the two programs:"
I must've done that after I copied one program to the other, but it does not matter, in both programs that area is inside the first pair of parenthesis, and it gets included in the match.
Anonymous Monk: "I think you have one too many $parens..."
I do not know how to say what the problem is any differently. I *want* to use $paren a second time and have it find the *second* separate parenthesized text string within the $stuff variable, and set the $2 regex memory variable equal to it. The regex defined in the variable $paren is set works, it successfully finds the first open '(' and balancing close ')' pair of parenthesis. Because I use it as:
/($paren)/
It sets the matching text to the $1 variable. How come I cannot use it again, via something like:
/($paren)[^()]+($paren)/
The sample $stuff variable does have a second, separate parenthesized text string in it ( "(for a while)" ) how come the same $paren regex does not find that second parenthsized string and set $2 to it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex's, parentheses, and the mysterious ( ??{ } ) operator
by Anonymous Monk on Jul 12, 2013 at 15:49 UTC | |
by Clovis_Sangrail (Beadle) on Jul 12, 2013 at 16:21 UTC | |
by Clovis_Sangrail (Beadle) on Jul 12, 2013 at 16:31 UTC | |
by AnomalousMonk (Archbishop) on Jul 12, 2013 at 18:42 UTC | |
by Clovis_Sangrail (Beadle) on Jul 15, 2013 at 17:08 UTC | |
| |
by Clovis_Sangrail (Beadle) on Jul 12, 2013 at 16:05 UTC | |
by AnomalousMonk (Archbishop) on Jul 12, 2013 at 18:00 UTC |