Andreas Röhler<andreas.roehler<at> easy-emacs.de> writes:
Am 25.01.2012 11:17, schrieb Tom:
(looking-at "\\(a\\c(?1:b\\)\\)")
AFAIU there are serveral errors,
think you can't refer to first match inside itself
You misunderstand the feature.
It's not a backreference. It's an explicit numbering of
the group, so it doesn't change if you add more parens:
`\(?NUM: ... \)'
is the "explicitly numbered group" construct. Normal groups get
their number implicitly, based on their position, which can be
inconvenient. This construct allows you to force a particular
group number. There is no particular restriction on the numbering,
e.g. you can have several groups with the same number in which case
the last one to match (i.e. the rightmost match) will win.
Implicitly numbered groups always get the smallest integer larger
than the one of any previous group.