Bash 5 bug in Cygwin only: empty pattern inside a regular expression
LLoyd
lloydsensei+cygwin@gmail.com
Mon Feb 24 16:01:07 GMT 2025
Hello.
I'll try to keep this short:
In Cygwin only, using bash 5.2.21-1 or 5.2.15-3 (the only 5.* versions
available), "empty" in a regular expression is not properly matched
and breaks the regular expression.
It's not a quoting issue, I also tested with:
reg='foo|'; [[ foo =~ $regex ]]
GNU bash, version 5.2.15(3)-release (x86_64-pc-cygwin)
GNU bash, version 5.2.21(1)-release (x86_64-pc-cygwin)
[[ foo =~ foo| ]] (is false, should be true)
[[ foo =~ foo|a ]] (is true)
[[ '' =~ foo| ]] (is false, should be true)
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
[[ foo =~ foo| ]] (is true)
[[ foo =~ foo|a ]] (is true)
[[ '' =~ foo| ]] (is true)
Thank you,
LLoyd
More information about the Cygwin
mailing list