this post was submitted on 12 Nov 2023
2 points (100.0% liked)
Emacs
311 readers
1 users here now
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Elisp regular expressions are case insensitive by default, so they should match uppercase letters too.
To just add a dash, you could simply put that into the second group. So
[a-z0-9-]
, you don’t have to escape it because it can’t be a range operator if it’s at the end of the group. The same goes for any other character you want to match.You could also use
[\\w. _-]
(notice the literal space between the dot and the underscore). The\w
is a shorthand forA-Za-z0-9
. This should match all valid filenames as long as they don’t contain letters with diacritics.