GNU bug report logs -
#17631
24.3.50; the following should return t
Previous Next
Reported by: Samuel Lê <samuel.le <at> gmail.com>
Date: Thu, 29 May 2014 15:43:01 UTC
Severity: normal
Tags: notabug
Found in version 24.3.50
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Samuel Lê wrote:
> I ran this code, as someone recommanded on the #emacs chan of freenode:
> (with-temp-buffer
> (insert "foo Bar")
> (goto-char (point-min))
> (re-search-forward "[[:upper:]]")
> (looking-at "Bar"))
>
> t was expected, but instead I got returned nil.
Your expectation is incorrect, for two reasons:
1. `[:upper:]'
This matches any upper-case letter, as determined by the current
case table (*note Case Tables::). If `case-fold-search' is
non-`nil', this also matches any lower-case letter.
2. re-search-forward leaves point at the end of the match, ie after "B"
in this case.
Compare:
(with-temp-buffer
(insert "foo Bar")
(goto-char (point-min))
(let (case-fold-search)
(re-search-forward "[[:upper:]]")
(looking-at "ar")))
The help-gnu-emacs mailing list is probably a better place to discuss
these things, but feel free to keep talking about it here.
I'll close this report though, since it is not a bug.
This bug report was last modified 11 years and 47 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.