help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numbered regexps throw invalid regex error


From: Andreas Röhler
Subject: Re: Numbered regexps throw invalid regex error
Date: Wed, 25 Jan 2012 21:02:13 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.24) Gecko/20111101 SUSE/3.1.16 Thunderbird/3.1.16

Am 25.01.2012 18:51, schrieb Tom:
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.





Okay, next try :)

you can't assign a group number already assigned automatically

that would work:

(looking-at "\\(?2:a\\(?1:b\\)c\\)")







reply via email to

[Prev in Thread] Current Thread [Next in Thread]