[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7267: 23.1; regexp backslash-B matches word
From: |
Glenn Morris |
Subject: |
bug#7267: 23.1; regexp backslash-B matches word |
Date: |
Fri, 22 Oct 2010 22:49:27 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
"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.