Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What regular expressions does c-x c-f (opening a file) in Emacs accept?

Tags:

regex

emacs

I know that it will accept '*' in file names, but standard regular expression operators such as '.' or character classes do not work. I thought this would be something that I would easily find online but after about 15 min of searching, I could not find an answer to my question to my dismay.

like image 891
Sam Avatar asked Feb 24 '23 14:02

Sam


1 Answers

From the Emacs manual "Visiting Files" section:

If the file name you specify contains shell-style wildcard characters, Emacs visits all the files that match it. (On case-insensitive filesystems, Emacs matches the wildcards disregarding the letter case.) Wildcards include ‘?’, ‘*’, and ‘[...]’ sequences.

So these are not regexps; they are simple shell-style wildcards. ? matches any single character, * matches zero or more characters, and [abc] matches any of the characters a, b, or c.

like image 182
Nemo Avatar answered May 20 '23 08:05

Nemo