Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2001 12:35:09 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Akinori MUSHA <knu@iDaemons.org>, current@freebsd.org
Subject:   Re: find(1) -regex/-iregex
Message-ID:  <3A93376D.B371FCD1@newsguy.com>
References:  <8666i588p4.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Akinori MUSHA wrote:
> 
> Hi,
> 
> I have implemented -regex and -iregex options for find(1):
> 
>     http://people.FreeBSD.org/~knu/misc/find_regex.diff

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.

> They are meant to be compatible with those of GNU's and NetBSD's:
> 
>     -regex <pattern>:
> 
>         True if the whole path of the file matches <pattern> using
>         basic regular expression.  To match a file named
>         ``./foo/xyzzy'', you can use the regular expression
>         ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy'' or
>         ``/foo/''.
> 
>     -iregex <pattern>:
> 
>         Like -regex, but the match is case insensitive.

You forgot -E (use extended regexp syntax), and the example you show
above is extended regexp syntax, not basic regexp syntax.

> I'd like to commit it after reviews if there is no convincing
> objection against it.  Any suggestion is welcome.

Well, I expressed my concerns above.

-- 
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com
dcs@freebsd.org
capo@the.fashionable.bsdconspiracy.net

	"Too bad sentience isn't a marketable commodity."

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A93376D.B371FCD1>