GNU bug report logs - #7267
23.1; regexp backslash-B matches word

Previous Next

Package: emacs;

Reported by: "Thibault Kruse" <thibault.kruse <at> gmx.de>

Date: Fri, 22 Oct 2010 18:52:02 UTC

Severity: normal

Found in version 23.1

Done: "Thibault Kruse" <thibault.kruse <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 7267 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7267 <at> debbugs.gnu.org
Subject: Re: bug#7267: 23.1; regexp backslash-B matches word
Date: Fri, 22 Oct 2010 22:49:27 -0400
"Thibault Kruse" wrote:

> According to emacs manual, \B matches the empty string, but it does not.

The elisp manual says:

Backslash Constructs in Regular Expressions
[...]

`\B'
     matches the empty string, but _not_ at the beginning or end of a
     word, nor at the beginning or end of the buffer (or string).

> start emacs with emacs -q --no-site-file
> move point over word in the splash screen.
> M-:
> (looking-at "\\B")
> minibuffer says: T, should say nil

Why do you think it should return nil?

This construct matches the empty string inside words.
It only returns nil at word boundaries. Try

(looking-at "\\B")

with point at the start, middle, and end of a word.
It returns nil, t, nil, as it should.

The empty string is _empty_, ie length zero, not whitespace or
anything like that.





This bug report was last modified 14 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.