For example, I have the following content in the buffer:


To match the 4 numbers, I need the regular expression of \d{4}. I would like to do the same in Emacs, when I press C-s and type the regexp.

When I'm looking in the documentation of Emacs regexp, many various regexp, Emacs own regexp, applications in Emacs Lisp, and so on, it's intensively documented.

I just want to have interactive search, type the regexp \d{4} and find the match. How could I apply that? The documentation gave no directly answer on this.

  • Press C-M-s and type [0-9]{4}. As far as I know that is the emacs-way.
    – Tobias
    Commented Apr 3, 2016 at 22:56

1 Answer 1


As far as I can tell, there is no \d in Emacs regular expressions. So, @Tobias's comment is (mostly) correct, except that you need to escape the curly brackets. Either of the following will work:

`C-M-s` => [0-9]\{4\}
`C-M-s` => [[:digit:]]\{4\}
  • Such a pity! I did verify the search including the backslash. I do not know why I missed the backslash in the comment. Maybe, it was the late hour. Thanks for correcting me.
    – Tobias
    Commented Apr 4, 2016 at 6:07
  • Thanks for your answer, Dan and @Tobias but I'm wondering why Emacs don't have any application for 'regular' regexp's?
    – ReneFroger
    Commented Apr 4, 2016 at 15:21
  • 2
    I know that the visual-regexp-steriods package adds support for python and perl like regular expressions
    – Jules
    Commented Apr 4, 2016 at 16:04
  • @ReneFroger: don't know, sorry. That sounds like a separate question and possibly a feature request.
    – Dan
    Commented Apr 4, 2016 at 16:07
  • @JulesTamagnan thanks for your answer, great package by the way!
    – ReneFroger
    Commented Apr 6, 2016 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.