From owner-freebsd-standards@FreeBSD.ORG Fri Sep 15 16:21:19 2006 Return-Path: X-Original-To: freebsd-standards@freebsd.org Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5CBBC16A40F for ; Fri, 15 Sep 2006 16:21:19 +0000 (UTC) (envelope-from zakj@nox.cx) Received: from nox.cx (twitch.nox.cx [69.55.228.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1ED3E43D64 for ; Fri, 15 Sep 2006 16:21:17 +0000 (GMT) (envelope-from zakj@nox.cx) Received: (qmail 11446 invoked by uid 1000); 15 Sep 2006 16:21:17 -0000 Message-ID: <20060915162117.11445.qmail@nox.cx> Date: Fri, 15 Sep 2006 09:21:17 -0700 From: Zak Johnson To: Volodymyr Kostyrko Mail-Followup-To: Volodymyr Kostyrko , freebsd-standards@freebsd.org References: <450AA821.9050000@synergetica.dn.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <450AA821.9050000@synergetica.dn.ua> Cc: freebsd-standards@freebsd.org Subject: Re: find regular expression question X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2006 16:21:19 -0000 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