Date: Fri, 15 Sep 2006 09:21:17 -0700 From: Zak Johnson <zakj@nox.cx> To: Volodymyr Kostyrko <arcade@synergetica.dn.ua> Cc: freebsd-standards@freebsd.org Subject: Re: find regular expression question Message-ID: <20060915162117.11445.qmail@nox.cx> In-Reply-To: <450AA821.9050000@synergetica.dn.ua> References: <450AA821.9050000@synergetica.dn.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Volodymyr Kostyrko wrote: > Just stumbled upon some inconsistences in find(1) regular expressions > parsing: > > [code] > > :>a > > find . -regex '^\./a\?$' > > find . | grep '^\./a\?$' > ./a > [/code] Find uses basic (obsolete) regular expressions by default; '?' is an ordinary character. You can use either of the following instead: find . -regex '^\./a\{0,1\}$' find -E . -regex '^\./a?$' find's '-E' option makes -regex use the extended regular expression syntax, documented in re_format(7). GNU grep uses its own---slightly different---re syntax, described in grep(1). -Zak
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060915162117.11445.qmail>