regex(3): support for \< and \> word delimiters
pfg at freebsd.org
Wed Jul 2 22:20:22 UTC 2014
On 07/02/14 16:21, Bryan Drewery wrote:
> On 6/27/2014 4:15 PM, Pedro Giffuni wrote:
>> Il giorno 27/giu/2014, alle ore 15:25, Bryan Drewery <bdrewery at FreeBSD.org> ha scritto:
>>> On 4/21/2014 1:53 PM, Pedro Giffuni wrote:
>>>> Is there any related standard (or in absence strong feelings)
>>>> about having \< and \> delimiters in regex expressions?
>>>> I have an old PR bin/153257 which actually comes from illumos:
>>>> I don't use them but maybe it would help people moving their
>>>> scripts from Solaris.
>>> I don't know about a standard, but I find the lack of \< \> to be a
>>> frustrating difference with other platforms. [[:<:]] [[:>:]] work but
>>> are far more characters to type.
>> Thank you for the feedback! I had closed the issue because I thought there was no interest.
>> Another thing that needed consideration was that I thought there was some work going on to replace libregex with libtre, which doesn’t support *any* such delimiter so committing the change would raise the bar for the replacement. Discussing it with Gabor it seems like libtre is not in the capacity of replacing our current libregex anyways so I guess Spencer’s libregex is here to stay.
>> While here, there is also the sed(1) syntax issue:
>> Adopting both changes would probably reduce to a minimum the use of GNU sed in the ports tree, but such changes are likely to be controversial(?) and I don’t feel like wearing asbestos underwear at this time .. at least not for sed ;).
> IMHO yes that is a good thing to bring over as it helps with people
> coming from other platforms and improves portability with scripts. I
> started on Linux and kept wondering why I had FILEe files all over my
> system until I realized -i '' was required on FreeBSD.
The original idea was, more or less, the contrary: by being stricter
about non-standard extensions you can be sure that the code
you made on FreeBSD will run unchanged on all existing
It is difficult to strike a balance though: POSIX has been
adopting some GNU extensions, so even if we reject them
initially at some point they become necessary.
The sed enhancement is actually pretty easy, and it looks like,
in addition to illumos, NetBSD has it too. It is not high on my
todo list though ;).
More information about the freebsd-standards