From owner-freebsd-current Tue Feb 20 21:51: 0 2001 Delivered-To: freebsd-current@freebsd.org Received: from mail.rdc1.kt.home.ne.jp (ha2.rdc1.kt.home.ne.jp [203.165.9.243]) by hub.freebsd.org (Postfix) with ESMTP id 285B937B401 for ; Tue, 20 Feb 2001 21:50:57 -0800 (PST) (envelope-from knu@iDaemons.org) Received: from daemon.local.idaemons.org ([203.165.161.10]) by mail.rdc1.kt.home.ne.jp (InterMail vM.4.01.02.00 201-229-116) with ESMTP id <20010221055056.LJKG19464.mail.rdc1.kt.home.ne.jp@daemon.local.idaemons.org>; Tue, 20 Feb 2001 21:50:56 -0800 Received: by daemon.local.idaemons.org (8.11.1/3.7W) id f1L5ouv08209; Wed, 21 Feb 2001 14:50:56 +0900 (JST) Date: Wed, 21 Feb 2001 14:50:56 +0900 Message-ID: <861yssr3cv.wl@archon.local.idaemons.org> From: "Akinori MUSHA" To: "Daniel C. Sobral" Cc: current@FreeBSD.ORG Subject: Re: find(1) -regex/-iregex In-Reply-To: <863dd8r54c.wl@archon.local.idaemons.org> References: <8666i588p4.wl@archon.local.idaemons.org> <3A93376D.B371FCD1@newsguy.com> <863dd8r54c.wl@archon.local.idaemons.org> User-Agent: Wanderlust/2.5.4 (Smooth) SEMI/1.14.2 (=?ISO-8859-1?Q?Daish=F2?= =?ISO-8859-1?Q?ji?=) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd) Organization: Associated I. Daemons X-PGP-Public-Key: finger knu@FreeBSD.org X-PGP-Fingerprint: 081D 099C 1705 861D 4B70 B04A 920B EFC7 9FD9 E1EE MIME-Version: 1.0 (generated by SEMI 1.14.2 - =?ISO-8859-1?Q?=22Daish=F2ji=22?=) Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At Wed, 21 Feb 2001 14:12:51 +0900, I wrote: > At Wed, 21 Feb 2001 12:35:09 +0900, > Daniel C. Sobral wrote: > > I'm not familiar with find sources, but it seems to me you execute > > regcomp() for each file name to be compared? If so... change that! :-) > > Regcomp() does expensive setup so that regexec() can be run > > inexpensively many times over. > > Indeed. I'll do it soon, thanks. Updated. http://people.FreeBSD.org/~knu/misc/find_regex.diff > > You forgot -E (use extended regexp syntax), and the example you show > > above is extended regexp syntax, not basic regexp syntax. Well, it was added after I had posted the original article. The latest one's find.1 mentions it. .It Fl E Interpret regular expressions followed by .Ic -regex and .Ic -iregex options as extended (modern) regular expressions rather than basic regular expressions (BRE's). The .Xr re_format 7 manual page fully describes both formats. As for the syntax my examples conform to, I think they are valid both for basic and extended. True if the whole path of the file matches .Ar pattern using regular expression. To match a file named ``./foo/xyzzy'', you can use the regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy'' or ``/foo/''. Thanks for your suggestions. -- / /__ __ Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org / Ruby-lang.org Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp "We're only at home when we're on the run, on the wing, on the fly" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message