Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Emacs character classes in a regular expression?

Tags:

regex

emacs

The Emacs documentation has a section on character classes. According to the manual, [:digit:] should match any digit character. I've tried that using re-builder but they never match, even though [0-9] matches.

How do I use character classes in an Emacs regex?

like image 624
Antoine Avatar asked Nov 12 '11 17:11

Antoine


1 Answers

I figured it out. The documentation is actually explicit:

Here is a table of the classes you can use in a character alternative

So [[:digit:]] is the right way to use character classes.

like image 52
Antoine Avatar answered Nov 14 '22 22:11

Antoine