zsh-workers
 help / color / mirror / code / Atom feed
* Re: substitution groups and patterns i replace string (Emacs' \\1 etc.)
       [not found]       ` <160307185234.ZM23145__47329.0627044209$1457405642$gmane$org@torch.brasslantern.com>
@ 2016-03-08 12:13         ` Stephane Chazelas
  0 siblings, 0 replies; only message in thread
From: Stephane Chazelas @ 2016-03-08 12:13 UTC (permalink / raw)
  To: zsh-workers

2016-03-07 18:52:34 -0800, Bart Schaefer:
> 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.
[...]

Note that ksh93 does support

$ var=aaabbcdd
$ print -r -- "${var//@(?)\1/2<\1>}"
2<a>a2<b>c2<d>

That is \1 both as a back-reference in the pattern and capture
group for the substitution.

-- 
Stephane


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-08 12:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87k2lk2ws9.fsf@debian.uxu>
     [not found] ` <20160303094140.705eb3bd@pwslap01u.europe.root.pri>
     [not found]   ` <87a8mccfmv.fsf@debian.uxu>
     [not found]     ` <CAHYJk3R_GwkJ2_ayNdZbT+8ByOC-hSRJrUV6Jch-w4uOVBjTsg@mail.gmail.com>
     [not found]       ` <160307185234.ZM23145__47329.0627044209$1457405642$gmane$org@torch.brasslantern.com>
2016-03-08 12:13         ` substitution groups and patterns i replace string (Emacs' \\1 etc.) Stephane Chazelas

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).