[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Numbered regexps throw invalid regex error
From: |
Tom |
Subject: |
Re: Numbered regexps throw invalid regex error |
Date: |
Wed, 25 Jan 2012 17:51:43 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>
> Am 25.01.2012 11:17, schrieb Tom:
> > (looking-at "\\(a\\(?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.
- Numbered regexps throw invalid regex error, Tom, 2012/01/25
- Re: Numbered regexps throw invalid regex error, Andreas Röhler, 2012/01/25
- Re: Numbered regexps throw invalid regex error,
Tom <=
- Re: Numbered regexps throw invalid regex error, Andreas Röhler, 2012/01/25
- Re: Numbered regexps throw invalid regex error, Tom, 2012/01/25
- Re: Numbered regexps throw invalid regex error, Andreas Röhler, 2012/01/25
- Re: Numbered regexps throw invalid regex error, Tom, 2012/01/26
- Re: Numbered regexps throw invalid regex error, Andreas Röhler, 2012/01/26
- Re: Numbered regexps throw invalid regex error, Tim Landscheidt, 2012/01/26
- Re: Numbered regexps throw invalid regex error, Tom, 2012/01/26