🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #1808

Re: 're-search-backward' bug in Emacs-18.55

#1808
From: Kyle Jones
Date: Tue, 02 Jan 1990 14:37
25 lines
1454 bytes
Shinichirou Sugou writes:
 > I think there is a bug in 're-search-backward' function.
 > [...]
 > [Reproduction]
 > (1) Open a empty buffer (says foo); type two characters, SPACE and 'a'; move
 >     the cursor just on the character 'a'.
 > (2) Eval (re-search-backward "\\`\\|\\s ")
 > (3) Eval (match-data)
 >     and you will see (#<marker at 1 in foo> #<marker at 1 in foo> )
 > 
 > [Bug]
 > In 're-search-backward', not "\\`" but "\\s " should be matched.  But
 > 'match-data' says that actual matching is "\\'".

You seem to be assuming that the alternative operator will always match
the largest of the two alternatives.  The documentation for `\|' does
not guarantee this.   From the _GNU Emacs Manual_, Section 13.5, "Syntax
of Regular Expressions"

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

This statement applies to the regular expression itself, not the text
that is being matched.
Technical Details
Message-ID: <1990Jan2.143701.18670@talos.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!uakari.primate.wisc.edu!xanth!talos!kjones
References: <8912301502.AA10078@sgtp.apple.juice.or.jp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!uakari.primate.wisc.edu!xanth!talos!kjones
From: kjones@talos.uu.net (Kyle Jones)
Newsgroups: gnu.emacs.bug
Subject: Re: 're-search-backward' bug in Emacs-18.55
Message-ID: <1990Jan2.143701.18670@talos.uu.net>
Date: 2 Jan 90 14:37:01 GMT
References: <8912301502.AA10078@sgtp.apple.juice.or.jp>
Reply-To: kjones@talos.uu.net
Lines: 25