zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: substitution groups and patterns i replace string (Emacs' \\1 etc.)
Date: Mon, 7 Mar 2016 18:52:34 -0800	[thread overview]
Message-ID: <160307185234.ZM23145@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3R_GwkJ2_ayNdZbT+8ByOC-hSRJrUV6Jch-w4uOVBjTsg@mail.gmail.com>

On Mar 6,  8:15am, Mikael Magnusson wrote:
}
} % echo ${a//(#b)([aoeui])/${(U)match[1]}}

It's actually quite simple to make $1, $2, ... refer to the values in
the $match array during ${v//p/r} substitutions.  This would make the
syntax look very perl-ish, but would mean you can't combine backrefs
with expansions of the normal positional parameters.

Anyone interested?  Discuss?

Incidentally, for a fun time consider replacing ${(U)match[1]} with
${(P)match[1]} in that substitution of Mikael's.


      reply	other threads:[~2016-03-08  2:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  1:08 Emanuel Berg
2016-03-03  9:41 ` Peter Stephenson
2016-03-06  5:57   ` Emanuel Berg
2016-03-06  7:15     ` Mikael Magnusson
2016-03-08  2:52       ` Bart Schaefer [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=160307185234.ZM23145@torch.brasslantern.com \
    --to=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).