According to the documentation of this function, it should be case sensitive. But when I test it out, the result is case insensitive.
My emacs version is
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
re-search-forward is case insensitive by default as it depends on (as @phils points out in the comment)
You can toggle case sensitivity with:
The following is from ergoemacs.org:
By default, Emacs regex is not case sensitive unless the pattern contains capital letters. That is, dragon will match “dragon” and “Dragon” and “DRAGON” and “draGON”. But Dragon will match only “Dragon”.
Case sensitivity is controlled by the variable case-fold-search. Alt+x toggle-case-fold-search to toggle it. Remember to toggle it back when you are done. Because case-fold-search is also used by isearch and basically all search or find/replace commands.
Do not use [A-z], because that'll match some punctuation chars too. Use [A-Za-z].
You can toggle case-sensitivity on the fly during Isearch, using
M-c. So just
C-M-s M-c will turn on case-sensitivity for the duration of the search (assuming it was turned off globally). You can toggle it back and forth as much as you want during the same search, which can be handy.