From: "S. Cowles" <scowles@earthlink.net>
To: zsh-users@sunsite.dk
Subject: Re: Bad "bad pattern" in ${foo//pat/repl} ?
Date: Wed, 4 Jun 2003 17:09:38 -0700 [thread overview]
Message-ID: <200306041709.41497.scowles@earthlink.net> (raw)
In-Reply-To: <1F95A0A7.2A3D4E3C.37FA9B8A@netscape.net>
almost a year ago, Bart Schaefer added the following note to the email
archives:
================================================
From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
To: zsh-workers@xxxxxxxxxx
Subject: Bad "bad pattern" in ${foo//pat/repl} ?
Date: Sat, 13 Jul 2002 21:35:31 +0000
Mailing-list: contact zsh-workers-help@sunsite.dk; run by ezmlm
(Never mind why the elements of $foo have spaces in them, I was fooling
with something else when I came across this.)
schaefer<501> foo=("a b" "a c" "b q" "x y")
schaefer<502> echo ${foo/#a*/yes}
yes yes b q x y
schaefer<503> echo ${foo//#a*/yes}
a b a c b q x y
schaefer<504> setopt extendedglob
schaefer<505> echo ${foo/#a*/yes}
yes yes b q x y
schaefer<506> echo ${foo//#a*/yes}
zsh: bad pattern: #a*
Surely both 503 and 506 are bugs (probably the same bug). One should be able
to anchor to the beginning of the string even when doing a replace-all (I do
admit it doesn't really make sense to do so, but ...).
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
================================================
with 4.1.1-test-3, I am still getting the same erroneous error message for
beginning of string operator (#), and a no-op for the end of string operator
(%). in each of the following examples, extendedglob is set.
03-06-04
16:44:44 [514] bubo7:scripts/zsh% a=" a b c d " ; s=" " ; r="" ; \
printf "a: >%s<\n" ${a//#${s}/${r}}
zsh: bad pattern: #
03-06-04
16:44:55 [515] bubo7:scripts/zsh% a=" a b c d " ; s=" " ; r="" ; \
printf "a: >%s<\n" ${a//%${s}/${r}}
a: > a b c d <
if they worked, these operations would be superb for left and right string
trims. the work around I've chosen is to use the read builtin to do the
whitespace trims. for non-whitespace trims, however, the problem remains.
does anyone have a workaround?
scowles at earthlink dot net
next prev parent reply other threads:[~2003-06-05 0:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-29 18:07 4.1.1 test-3 PeterWStephenson
2003-06-05 0:09 ` S. Cowles [this message]
2003-06-05 9:45 ` Bad "bad pattern" in ${foo//pat/repl} ? Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200306041709.41497.scowles@earthlink.net \
--to=scowles@earthlink.net \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).