On Fri, Oct 27, 2023, at 12:25 AM, Grisha Levit wrote:
> On Thu, Oct 26, 2023, 20:30 Dale R. Worley <wor...@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