in reply to Regex conditional match if previous match in same expression is true?
Your expression just never needs to match the braces at all. If you add \s at the beginning and end of the expression (to force Perl to look at something beyond 'hello'), you get the expected result.
Update: In my fooling around, I'd also changed ([{]{0,1}) to ([{])? (because the first version, as merlyn says, will always match, but sometimes an empty string). That's also necessary to make it work as expected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex conditional match if previous match in same expression is true?
by radiantmatrix (Parson) on Apr 09, 2007 at 17:56 UTC | |
by kyle (Abbot) on Apr 09, 2007 at 18:23 UTC |