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: Leonid Isaev (ifax)
Subject: Re: What is wrong with a regex?
Date: Sat, 4 Feb 2023 05:11:44 +0000
User-agent: Mutt/1.13.4 (2020-02-15)

On Fri, Feb 03, 2023 at 10:10:40PM -0600, Peng Yu wrote:
> That would be a syntax error as the return status 2 indicates.
> $ f=row.txt; [[ $f =~ ^row([0-9]*)(|_x)[.]txt$ ]]; echo $?
> 2

-----8<-----
I-orca--05:07-~-> f="row.txt"; [[ "$f" =~ ^row([0-9]*)(|_x)[.]txt$ ]]; echo $?; 
echo -E "${BASH_REMATCH[@]}"
0
row.txt
----->8-----
How did you get 2? Is this a new feature in bash? I get the above result in
bash 5.0.16(1)-release (ArchLinux) and 4.4.20(1)-release (AlmaLinux 8).

-- 
Leonid Isaev



reply via email to

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