[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:54 +0100 |
User-agent: |
Evolution 3.42.2-1 |
On Sat, 2022-01-08 at 12:49 -0500, Chet Ramey wrote:
> It's not a violation. There are a couple of interpretations that
> attempt to
> clarify the distinction between "shell-quoted characters" and
> characters
> that are quoted for the pattern. These primarily involve
> backslashes,
> since the only way to quote a pattern special character in a pattern
> is by
> using a backslash, but it applies to other shell quoting as well.
>
> For instance, if you have
>
> case . in
> '[.]') echo match ;;
> *) echo no match ;;
> esac
>
> do you think the user's desire is to have it print `match'?
Uhm...
It's a trap! :-P
But as far as I understand now, the [.] is taken literally because of
the [ being quoted, so no match.
> > >
> There's no missing closing bracket. dash doesn't understand $[], and
> an
> opening bracket without a matching close is not a pattern syntax
> error,
> just a string to match.
>
> > And even stranger that (d)ash then matches [.xxxxxxxxxxxx^$[] ...
> > how
> > did you construct that?
>
> Why is this strange? That's a valid pattern expression for dash's
> matcher
> (the backslash escapes the ending `]'). The `*' in the pattern
> matches an
> arbitrary number of `x's.
Both clear in the meantime... I forgot about [ without a closing ]
being a valid pattern.
Thanks as well,... also for the pointers to the discussion at the
Austin Group.
Chris.
- Re: help with pattern matching needed, (continued)
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/07
- Re: help with pattern matching needed, Chet Ramey, 2022/01/08
- Re: help with pattern matching needed,
Christoph Anton Mitterer <=
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/11
- Re: help with pattern matching needed, Lawrence Velázquez, 2022/01/11
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/11
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Lawrence Velázquez, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12