I have some files whose the names are of the form krita-NN.kra where NN is a number having one to two digits. I wanted to locate them using Emacs regex. However, the repetition postfix operator (\{n, m\}, \{n\}) of Emacs regex doesn't seem to be accepted by locate. Specifically, both

  • locate --regex --regextype emacs 'krita-[0-9]\.kra$'

  • locate --regex --regextype emacs 'krita-[0-9][0-9]\.kra$'

return relevant results, but no regexes in the following work

  • locate --regex --regextype emacs 'krita-[0-9]\{1,2\}\.kra$ ;
  • locate --regex --regextype emacs 'krita-[0-9]\{1\}\.kra$.

Even if curly brackets are not escaped.

Question: Does locate accept Emacs regex as it claims in the man page?


  • This question is not looking for alternative solution e.g. with find or other regex type.
  • locate version: locate (GNU findutils) 4.7.0
  • See info -n emacs locate Nov 16, 2020 at 9:40
  • @StéphaneChazelas Thanks, I should admit that I rarely go beyond man page, even if it told me to consult the Texinfo documentation... Lesson learned. Nov 16, 2020 at 10:25

1 Answer 1


According to @Stéphane Chazelas's suggestion, the Texinfo documentation (info -n emacs locate) doesn't specify repetition operator for emacs regex unlike Emacs regex. A contrario, the regex type grep supports it with the syntax I expected. Namely,

locate --regex --regextype grep 'krita-[0-9]\{1,2\}\.kra$

solves the issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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