Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Match to the end of string when using (S) flag
- X-seq: zsh-users 23745
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Match to the end of string when using (S) flag
- Date: Wed, 7 Nov 2018 07:25:13 -0800
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vc25MS9hcSg605DeDY6aMFV2QFnVrDQ2XQqwz4mCsJM=; b=EFRTqe3bXr9v1MItb5RI/xs0D4TQA+SELdFvmsfbSUA3YUfTq/QAZn1WGIkuhblG2d 3NFFO7J+O8n0PUTyOZlScZeGgMkkNaGEl2pWnP8h/ZvzTjjt7tfJfB9aK97OVxdRbivY e7/iisTz34CXhtLAzFGPHBxmdg5Kj3L+BZX7+GzeO9CCxEB2+yGeuSD/OKvH0gSSzbDV EzGtx/UG7Xihyyr+5kV7MZJXTZBe+Zg2bQ+Ujh3FBjmBTtOqHgJ2xz1O8zyR7aqNKaBY hBq2g4jvT60aEq1HwVZro3UDXPeam84S2AFKTicH6+TBtTryfDCTgd1j9R/DdDF/A/92 zc9g==
- In-reply-to: <CAKc7PVALXm-sJ09DdSGip_nR6TYBrSiD2BHs7CYw7f_gA46sxQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <1478010333.3056500.773811025.1AAA4FEC@webmail.messagingengine.com> <1478017673.3085741.773974873.7C58DD0B@webmail.messagingengine.com> <1478024975.3113621.774078481.323B1F9E@webmail.messagingengine.com> <161101142301.ZM25643@torch.brasslantern.com> <CAKc7PVALXm-sJ09DdSGip_nR6TYBrSiD2BHs7CYw7f_gA46sxQ@mail.gmail.com>
On Wed, Nov 7, 2018 at 4:30 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> % text='# This is an example code that is diverse and allows to test a'
> % local last=""; : ${text//(#b)([a-d])/${last=${match[1]}}}; print -rl $last
> <empty result>
>
> With #m:
> % local last=""; : ${text//(#m)([a-d])/${last=$MATCH}}; print -rl $last
> <empty result>
>
> How come it works for you?
In your expression, $last already has a value (empty string), so you
need ${last::=$match[1]} or ${last::=$MATCH} to assign it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author