Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Possible bug with $~pattern, (#mi)
On Wed, 7 Oct 2015 18:06:43 +0200
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> When beg is used (this time correctly):
>
> # a="1234"; beg="#"; echo ${a/$~beg(#mi)1/-}
> zsh: bad pattern: #(#mi)1
Bart's explained this in a more practical way, but you might want to
read the documentation. It's not well written, actually: the point it's
making is that the # or % isn't part of the pattern, it's part of the
substitution syntax. "The pattern may be preceded by..." or "The / may
be followed by..." would put it better, so I might change it. "%" isn't
part of pattern syntax at all, so that would fail silently.
The pattern may begin with a `#', in which case the pattern must
match at the start of the string, or `%', in which case it must
match at the end of the string, or `#%' in which case the pat‐
tern must match the entire string. The repl may be an empty
string, in which case the final `/' may also be omitted. To
quote the final `/' in other cases it should be preceded by a
single backslash; this is not necessary if the `/' occurs inside
a substituted parameter. Note also that the `#', `%' and `#%
are not active if they occur inside a substituted parameter,
even at the start.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author