I've two files in the current folder:


the following find does not show the two files:

find . -regex .*submit\(Web\)?\.m

But the above regex expression works fine in emacs buffer, i.e., search for the example strings in the emacs buffer using isearch-forward-regexp.

The default regextype for find is emacs.

But it seems that find consider \( as a left bracket in the filename, which differs from emacs regex syntax.

So is this a bug or my misunderstanding of find manpage?

1 Answer 1


It seems that the problem is \( is interpreted by the shell first.

For example, you got a file in the current directory named:



ls foo\(.text


ls "foo(.text"

both work.

So, the following works:

find . -regex ".*submit\(Web\)?\.m"


Single quote also works here.

Difference between single quote and double quote, see this post: single quote vs double quote in bash

  • Or put the regex in single quotes instead: find . -regex '.*submit\(Web\)?\.m'
    – slm
    May 26, 2013 at 1:44
  • @slm Yes, anyway, just prevent the shell from interpreting the \(. Edited. May 26, 2013 at 4:08
  • 2
    A good rule of thumb is to quote everything in single quotes unless you specifically need the substitution behavior of double quotes.
    – tripleee
    May 26, 2013 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .