help-bash
[Top][All Lists]
Advanced

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

Re: help with pattern matching needed


From: Christoph Anton Mitterer
Subject: Re: help with pattern matching needed
Date: Tue, 11 Jan 2022 00:07:52 +0100
User-agent: Evolution 3.42.2-1

On Fri, 2022-01-07 at 18:01 -0500, Lawrence Velázquez wrote:
> It's not invalid, though.  An unquoted [ can match literally.
> 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01:

Yeah, I was confused by the patterns '[' referring to "XBD RE Bracket
Expression" (which would not allow the empty unquoted open bracket),
while for the patterns it is allowed.



On Fri, 2022-01-07 at 18:44 -0500, Lawrence Velázquez wrote:
> As I noted in the message I just sent, POSIX doesn't actually say
> that case patterns undergo quote removal; rather, it addresses
> quoting in its description of pattern matching.  This kinda sorta
> covers the observed behavior, but it could certainly be clearer.

I was especially confused by the [ of the patterns referring to the
BRE's in which the characters would be taken literally (and there would
be two stages of unquoting).


> 
> More or less.  Without an unquoted ], there is no bracket expression,
> so:
> 
>     - The unquoted [ characters match literally.
>     - The unquoted * retains its special meaning and matches zero
>       or more arbitrary characters.

With [ alone being taken literally in patterns, it's clear!


Thanks again for your help :-)

Chris.




reply via email to

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