[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is wrong with a regex?

From: Leonid Isaev
Subject: Re: What is wrong with a regex?
Date: Sat, 4 Feb 2023 15:11:50 +0000
User-agent: Mutt/1.13.4 (2020-02-15)

On Sat, Feb 04, 2023 at 02:20:20PM +0900, Koichi Murase wrote:
> Bash relies on the system library <regex.h> for the regular
> expressions, so I guess the Bash version is not so much related to
> this behavior difference.

Thanks for the explanation.
> I also checked the behavior of Cygwin, where <regex.h> seems to be
> implemented as a part of Newlib. Newlib <regex.h> also seems to
> support an empty <ERE_branch> and thus (|_x).

FYI, on Alpine (musl libc), bash also supports empty regex branch:
alp-gofax:~$ bash --version
GNU bash, version 5.2.9(1)-release (x86_64-alpine-linux-musl)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

alp-gofax:~$ ldd /bin/bash
        /lib/ (0x7f39944cd000) => /usr/lib/ (0x7f39943b3000) => /lib/ (0x7f39944cd000) => /usr/lib/ (0x7f3994356000)

alp-gofax:~$ f="row.txt"; [[ "$f" =~ ^r(|o)w ]]; echo "$?"; printf "%s|" 
"${BASH_REMATCH[@]}"; echo

Leonid Isaev

reply via email to

[Prev in Thread] Current Thread [Next in Thread]