[Top][All Lists]

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

bug#17631: 24.3.50; the following should return t

From: Glenn Morris
Subject: bug#17631: 24.3.50; the following should return t
Date: Thu, 29 May 2014 11:51:42 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

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.


   (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.

reply via email to

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