bug-bash
[Top][All Lists]
Advanced

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

Re: Regex: A case where the longest match isn't being found


From: Lawrence Velázquez
Subject: Re: Regex: A case where the longest match isn't being found
Date: Fri, 27 Oct 2023 01:04:50 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-1048-g9229b632c5-fm-20231019.001-g9229b632

On Fri, Oct 27, 2023, at 12:25 AM, Grisha Levit wrote:
> On Thu, Oct 26, 2023, 20:30 Dale R. Worley <worley@alum.mit.edu> wrote:
>
>> I suspect the difference between the versions is how the regexp is
>> unquoted while it is being read, with version 3 interpreting [^\'] as
>> "character class excluding newline, backslash, and quote" and version 5
>> interpreting it as "character class excluding newline and quote".
>>
>
> That seems right

How?  If it were right, wouldn't these produce different results?

        % cat foo.bash
        printf %s\\n "$BASH_VERSION"
        if [[ \\ =~ [^\'] ]]
        then
                printf %s\\n "${BASH_REMATCH[0]}"
        fi
        % /bin/bash ./foo.bash
        3.2.57(1)-release
        \
        % /opt/local/bin/bash ./foo.bash
        5.2.15(1)-release
        \

-- 
vq



reply via email to

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