Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs: is there a way to specify a case-insensitive search in a regexp?

Tags:

regex

emacs

In Javascript, I just need to append a i to the regexp to make it case-insensitive. In .NET, I use a RegexOptions.IgnoreCase.

I know about case-fold-search. What I want is to specify that behavior in the regex itself, as specified in an elisp program. Possible?

like image 728
Cheeso Avatar asked May 31 '10 15:05

Cheeso


People also ask

How do you make a regex match not case-sensitive?

To disable case-sensitive matching for regexp , use the 'ignorecase' option.

Are regex expressions case-sensitive?

By default, the comparison of an input string with any literal characters in a regular expression pattern is case-sensitive, white space in a regular expression pattern is interpreted as literal white-space characters, and capturing groups in a regular expression are named implicitly as well as explicitly.

How do I find regex Emacs?

Regular Expression Search In GNU Emacs, you can search for the next match for a regexp either incrementally or not. Incremental search for a regexp is done by typing C-M-s ( isearch-forward-regexp ).


1 Answers

As someone said earlier, the way to control this is to bind case-fold-search. There is no way to specify the regex's case-sensitivity (or lack thereof) in the regex itself.

As it happens, regexp matching is already case-insensitive by default.

like image 83
offby1 Avatar answered Nov 05 '22 13:11

offby1