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: Peng Yu
Subject: Re: What is wrong with a regex?
Date: Sat, 4 Feb 2023 19:59:55 -0600

On 2/3/23, Leonid Isaev (ifax) <leonid.isaev@ifax.com> wrote:
> 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).

$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin20.3.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

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

-- 
Regards,
Peng



reply via email to

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