 <p>On Mac OS X, you can't use <code>\|</code> in a basic regular expression, which is what <code>find</code> uses by default.</p> <p><a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/re_format.7.html#//apple_ref/doc/man/7/re_format">re_format man page</a></p> <blockquote> <p>[basic] regular expressions differ in several respects. | is an ordinary character and there is no equivalent for its functionality.</p> </blockquote> <p>The easiest fix in this case is to change <code>\(m\|h\)</code> to <code>[mh]</code>, e.g.</p> <pre><code>find ./ -regex '.*[mh]$' </code></pre> <p>Or you could add the <code>-E</code> option to tell find to use extended regular expressions instead.</p> <pre><code>find -E ./ -regex '.*(m|h)$' </code></pre> <p>Unfortunately <code>-E</code> isn't portable.</p> <p>Also note that if you only want to list files ending in <code>.m</code> or <code>.h</code>, you have to escape the dot, e.g.</p> <pre><code>find ./ -regex '.*\.[mh]$' </code></pre> <p>If you find this confusing (me too), there's a great reference table that shows which features are supported on which systems.</p> <p><a href="http://www.greenend.org.uk/rjk/2002/06/regexp.html">Regex Syntax Summary</a> [<a href="http://webcache.googleusercontent.com/search?q=cache%3ahttp://www.greenend.org.uk/rjk/2002/06/regexp.html">Google Cache</a>]</p>