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 23746
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Match to the end of string when using (S) flag
- Date: Wed, 7 Nov 2018 18:16:16 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jANy7Vn0og2PwbNpwruSxku85dg8Bz5AHGD/gacBYEE=; b=dgaBBGQYcR64fNx/B1Xc+3Bc+JSYZuC3W4Jl53AWjhEN1zf62bVs2gapYdgobLdj9M r1k4JTt7DLMrTDYX4AyG8HDvLPNav8gqGeZaVWrR4RcJhEoO2phjN4yJ4uccpCGpr4kc 54/NQtnlmNlp/VETtbXi/iDOWiV+4ff7b+QKHrW8uxLvmTI8/FcMEqObCbiWwUlntZQH jnCtYHLXrQrDJsbELUbMpfp9lr8zO95zaX3mOzv93v2d62g80B2T4Z1WEqxgMS3odYOV tJuHMx3rpAsKjYHMeBG8vr59yGKLHg+aHjQIBS28eMWmrh/B+0exvLCL7D42uu7Uxmdu 1VVg==
- In-reply-to: <CAH+w=7ZqjCK2PWQLWVAJ+bBumrQSUw-GDugDJvDKkHZ60m0WkQ@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> <CAH+w=7ZqjCK2PWQLWVAJ+bBumrQSUw-GDugDJvDKkHZ60m0WkQ@mail.gmail.com>
On Wed, 7 Nov 2018 at 16:25, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> 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.
It now works, thanks!
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author