help-bash
[Top][All Lists]
Advanced

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

Re: What is wrong with a regex?


From: Jeffrey Walton
Subject: Re: What is wrong with a regex?
Date: Sat, 4 Feb 2023 01:10:09 -0500

On Sat, Feb 4, 2023 at 12:45 AM Koichi Murase <myoga.murase@gmail.com> wrote:
>
> 2023年2月4日(土) 14:20 Koichi Murase <myoga.murase@gmail.com>:
> > From POSIX XCU 9.5.3
>
> Sorry, it's not XCU 9.5.3, but XBD 9.5.3.
>
> ----
>
> I also tried other systems.
>
> * Solaris doesn't support `(|x)' but seems to successfully compile the
> regular expression and later fails on the tests. [[ oo =~ (|o) ]]
> returns 1. The system grep doesn't support -E, but grep '\(\|o\)' <<<
> foo returns 1. The conforming /usr/xpg4/bin/grep supports -E and it
> returns 1.
>
> * FreeBSD, OpenBSD, and Minix do not support `(|x)' and return 2 for
> both grep and [[ ]]. grep outputs an error message "grep: empty
> (sub)expression". This is consistent with the report from Dennis.
>
> * Void Linux adopts the musl libc as its default C library. In this
> system [[ oo =~ (|o) ]] seems to return 1. On the other hand, grep in
> Void Linux is GNU grep and succeeds with the empty subexpression.

You might also try the test on Linux after setting the POSIXLY_CORRECT
environmental variable. It may make GNU gear more conformant. I think
you can also start bash with --posix option.

Also see https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
.

Jeff



reply via email to

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