Perl Monk, Perl Meditation | |
PerlMonks |
Re^2: Regex conditional match if previous match in same expression is true?by radiantmatrix (Parson) |
on Apr 09, 2007 at 18:04 UTC ( [id://609001]=note: print w/replies, xml ) | Need Help?? |
Well, that's certainly an improvement -- I had forgotten about all of the behaviors of the ? modifier. However, I must still be missing something. My code now reads:
But my output is: YEP - { YEP - YEP - YEP - However, now warnings are thrown for using an uninitialized '$1' in the last three cases, as it should be. What I'm struggling with is how to say that '{hello}' is OK, and 'hello' is OK, but '{hello' and 'hello}' are NOT OK. Or, put another way, I want to require a closing brace if an opening brace is found; however, if there is no opening brace then there must be no closing brace either. Thanks for the help, though, it's an improvement.
<–radiant.matrix–>
Ramblings and references The Code that can be seen is not the true Code I haven't found a problem yet that can't be solved by a well-placed trebuchet
In Section
Seekers of Perl Wisdom
|
|