Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (#m) and "case" alternation
- X-seq: zsh-workers 33678
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: (#m) and "case" alternation
- Date: Tue, 11 Nov 2014 17:43:26 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=GqYd0GHRhV6pftscnjpnICpBVqqiFgA5WmNE1+Tm1Gg=; b=GD7IuJa245iYwn8zJ08OOChqEQN7S+x4ZaDLc09Gf6GuDFeSJImwFdh07O7gaQEQg0 S/C9xTwoj1QDY4KKPNPQrmN8Q+T1TPhfSUeDCjWAwIQ5jQNqdSOhIIHRS83I6JsGgwtD JP32CbKRlD8hTFW44iCMgwM6fDhimKFbWOY2a4j6GaRnBE3GkvW39JKhMTCJQqZuxyzW Vsmn3nrzh6AoMC2Q2R9kiJ1ZeE1B03hcQC/caROQcEXhK2FpRXmmBrQnb5tjI9QA+dth EV8fbfWej0JBCNsjeLG3VcC92Wt2nlDDfALeGKwsLkB2DJmEo1ur/atZnJuY2cOm7gFP VQ/Q==
- In-reply-to: <141111074407.ZM30753@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20141111125423.GA4343@chaz.gmail.com> <141111074407.ZM30753@torch.brasslantern.com>
2014-11-11 07:44:07 -0800, Bart Schaefer:
> On Nov 11, 12:54pm, Stephane Chazelas wrote:
> }
> } Some unexpected behaviour:
> }
> } $ case abc in ((#m)a* | b*) echo $MATCH; esac
>
> It shouldn't be unexpected, because it's documented:
>
> m
> Set references to the match data for the entire string matched;
> this is similar to backreferencing and does not work in filename
> generation. THE FLAG MUST BE IN EFFECT AT THE END OF THE PATTERN,
> i.e. NOT LOCAL TO A GROUP.
>
> (all-caps mine).
OK, but in:
case abc in (#m)a* | b*) echo $MATCH; esac
my understanding was that we've got two patterns as that's the
"|" case alternation operator, not the "|" glob operator (with
which you can't have spaces on either side)..
Now, it looks like my understanding is wrong as
$ case bcd in ((#b)(a*) | (#b)(b*)) print -l "$match[@]";;esac
bcd
(bcd is in $match[2], so the second group of a *single*
pattern).
So thanks for the clarification, you may disregard my report.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author