Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2023 20:04:29 +0100
From:      Jamie Landeg-Jones <jamie@catflap.org>
To:        yuri@aetern.org, freebsd-current@FreeBSD.org
Subject:   Re: find(1): I18N gone wild ?
Message-ID:  <202304211904.33LJ4TA3044065@donotpassgo.dyslexicfish.net>
In-Reply-To: <f3d84036-b36e-d0d7-874a-51872a4ea572@aetern.org>
References:  <E427B1B8-22E0-47C0-BF47-0C4F1D5F962F.ref@yahoo.com> <E427B1B8-22E0-47C0-BF47-0C4F1D5F962F@yahoo.com> <3e473603-f384-f176-e7cb-03409e16ec9c@aetern.org> <f3d84036-b36e-d0d7-874a-51872a4ea572@aetern.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Yuri <yuri@aetern.org> wrote:

> > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
> > 
> > ...which in turn refers to the following link for bracket expressions:
> > 
> > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05
> > 
> > Why we don't support all of that is different story.
>
> A bit more on this; first link applies both to find(1) and fnmatch(3),
> and find uses fnmatch() internally (which is good), but even the
> function that processes bracket expressions is called rangematch() and
> that's really all it does ignoring other bracket expression rules:
>
> https://cgit.freebsd.org/src/tree/lib/libc/gen/fnmatch.c#n234
>
> So to "fix" find we just need to implement the bracket expressions
> properly in fnmatch().

No. find "-name" works with GLOBs not regex.

The functionality you are talking about, and the page you quoted refer to regular expressions.

For that, you use find "-regex" - note that the regex is assumed anchored, so:

$ LANG=en_US.UTF-8 find -E /etc/rc.d -regex '.*[[:upper:]]+' -print
/etc/rc.d/NETWORKING
/etc/rc.d/FILESYSTEMS
/etc/rc.d/SERVERS
/etc/rc.d/DAEMON
/etc/rc.d/LOGIN
$

Jamie



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