Re: find(1): I18N gone wild ?

From: Jamie Landeg-Jones <jamie_at_catflap.org>
Date: Fri, 21 Apr 2023 19:04:29 UTC
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