zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Match to the end of string when using (S) flag
Date: Wed, 7 Nov 2018 18:16:16 +0100	[thread overview]
Message-ID: <CAKc7PVCz5ykh5XjfDfgVi4MuzVzhS2YoS2zuXeQWgGQkw6KQ_w@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZqjCK2PWQLWVAJ+bBumrQSUw-GDugDJvDKkHZ60m0WkQ@mail.gmail.com>

On Wed, 7 Nov 2018 at 16:25, Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Wed, Nov 7, 2018 at 4:30 AM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> 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

      reply	other threads:[~2018-11-07 17:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 14:25 Sebastian Gniazdowski
2016-11-01 16:27 ` Sebastian Gniazdowski
2016-11-01 18:29   ` Sebastian Gniazdowski
2016-11-01 21:23     ` Bart Schaefer
2016-11-02  6:53       ` Sebastian Gniazdowski
2016-11-02 15:50         ` Bart Schaefer
2016-11-02  9:46       ` Peter Stephenson
2018-11-07 12:30       ` Sebastian Gniazdowski
2018-11-07 15:25         ` Bart Schaefer
2018-11-07 17:16           ` Sebastian Gniazdowski [this message]

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=CAKc7PVCz5ykh5XjfDfgVi4MuzVzhS2YoS2zuXeQWgGQkw6KQ_w@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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).