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

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

bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered group"


From: Andreas Schwab
Subject: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered group"
Date: Fri, 03 Apr 2009 21:55:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Joe Corneli <holtzermann17@gmail.com> writes:

> Please execute the following forms with C-x C-e.  Form 1
> and Form 3 return `t' (Yes, we are looking at the
> indicated regular expression), whereas Form 2 returns
> `nil' (even though from the Elisp reference page "34.3.1.3
> Backslash Constructs in Regular Expressions", it appears
> that this form ought to return `t' like the others).

     `\|' applies to the largest possible surrounding expressions.
     Only a surrounding `\( ... \)' grouping can limit the grouping
     power of `\|'.

> (let ((possible-environments
>        "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
>       (looking-at
>             (concat "\n*?\\\\begin{"
>                     possible-environments
>                     "}")))


The three alternatives of this regexp are "\n*?\\\\begin{\\(?1:lisp\\)",
"\\(?1:idea\\)" and "\\(?1:common\\)".

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






reply via email to

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