in reply to Re^2: Backref in a regex quantifier
in thread Backref in a regex quantifier
Good question.
My guess would be that they're not supposed to work -- text matched in a backreference is matched textually, without metacharacters. So doing /^(.)\1$/ won't match a wildcard as a second character if the first is a literal ".", and won't match one or more "+" if the first character is a literal "+".
Keeping to that pattern, it makes sense that if a backreference appears between {}, what's parsed is a literal "{", the backreference, and a literal "}".
It would obviously complicate regexen something fierce if the possibility of recompiling the regex based on backreferences had to be handled in the general case, and not just in the ??{} case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Backref in a regex quantifier
by TimToady (Parson) on Jul 09, 2007 at 20:00 UTC |