Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2023 21:12:40 +0200
From:      Yuri <yuri@aetern.org>
To:        freebsd-current@FreeBSD.org
Subject:   Re: find(1): I18N gone wild ?
Message-ID:  <dc9f6a9e-e380-a814-95f7-3ed01c4d447d@aetern.org>
In-Reply-To: <202304211904.33LJ4TA3044065@donotpassgo.dyslexicfish.net>
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> <202304211904.33LJ4TA3044065@donotpassgo.dyslexicfish.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Jamie Landeg-Jones wrote:
> 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.

No, find "-name" works with pattern rules in the first link, please see:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html

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

The functionality I am talking about is defined in find specification
above, the only relation to REs is for bracket expressions (with !
instead of ^).

> 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?dc9f6a9e-e380-a814-95f7-3ed01c4d447d>