Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] String equal when compared, processed differently via //
- X-seq: zsh-workers 39408
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] String equal when compared, processed differently via //
- Date: Wed, 21 Sep 2016 14:13:09 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=4HvzDm2Kd8qh72rMRCZPtNexuN/lp71F86YHqeVKmyA=; b=LCr086ahYsXfLs3/8hLvl5emGMvBo+7+IX90Sog0qn3owXuBLXtsO7mjRqV+H48twb O1r6mzRJiAWhzi/nWbhjS94zac7Z7Q6w/s3gABPRGFueZU/dWkZpXvZRr0m5YMiy7nML eQMRnfbGk1/AlrcZT9ylA8rixLgcjwh/I4Cu4Ti88Uy1/K3xdFn+aH1lYvCQ/eH6JPoM kJkEYA0dXmmQYUGghHSMwvYYsPqzpGVt711LBcX7eIUtBIy9L51h0ilUM6wPULVrwmE1 K1PORdKutlNsmW/ybmseIjznIH/S1M0unBGw9O2XcNH+IGEygCjbeUN2LMmRxCkTsrUm 42oA==
- In-reply-to: <CAKc7PVDfnz1Vm3=YzmZou5NG3YphyTwsA6-kWX=gHyknJdUJ9g@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAdnzTRk8mUZVrFJHKWr_Q9-8whffw7DAUpnkYqwX24yg@mail.gmail.com> <CAKc7PVCjbaHiAm4ssJGtLLk-tN3o8SuN+wgzLUJUeeG2PFcVMA@mail.gmail.com> <CAKc7PVDT6D2_63z_eE2OKwusrwZknK7N6azCPhg_bu=5LxQC=w@mail.gmail.com> <CAKc7PVCxPM2OoLW6-FhF7nFO+qNTMCmiNo7xJbb=bDx6P66POg@mail.gmail.com> <CAKc7PVDfnz1Vm3=YzmZou5NG3YphyTwsA6-kWX=gHyknJdUJ9g@mail.gmail.com>
On Sep 21, 12:37pm, Sebastian Gniazdowski wrote:
}
} Ah no it doesn't help, it simply doesn't match at all and repeat output ...
I suspect we've mis-communicated somehow.
I made up the little test script appended at the end of this message.
It copies you gitcmd from workers/39403 but modified a little to put
markers around the five bits of output [1|one][2|two][3|three]...
Then it applies first your all-in-one substitution from workers/39403
(with double close brace after $match[2]) my suggested all-in-one
(with double close brace after $match[5]) from workers/39404 and my
for-loop (pattern tweaked to more closely match 39403, before I was
using the pattern from minimal4.zsh that you sent earlier).
What specifically is wrong ("doesn't match at all") with the latter two?
--- 8< -- snip -- 8< ---
#!/usr/bin/env zsh
emulate -LR zsh
setopt extendedglob
gitcmd=( git log --max-count=3 --pretty=format:'[1|%h]%x01[2|%s]%x02[3|%d]%x03[4|%cr]%x04[5|%an]' --abbrev-commit )
gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" )
CMDR_GREEN='{G>'
CMDR_GREEN_E='<G}'
CMDR_MAGENTA='{M>'
CMDR_MAGENTA_E='<M}'
print -rl -- INPUT: "${gitout[@]}" ""
sebastian_out=(
"${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${CMDR_GREEN}${match[1]}${CMDR_GREEN_E}
${(q-)match[2]}} >${match[3]}<
${CMDR_MAGENTA}${(q-)match[4]}${CMDR_MAGENTA_E} ${match[5]}" )
print -rl -- +++++++++++++
print -rl -- workers/39403: "${sebastian_out[@]}"
bart_out=(
"${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${CMDR_GREEN}${match[1]}${CMDR_GREEN_E}
${(q-)match[2]} >${match[3]}<
${CMDR_MAGENTA}${(q-)match[4]}${CMDR_MAGENTA_E} ${match[5]}}" )
print -rl -- +++++++++++++
print -rl -- workers/39404: "${bart_out[@]}"
integer i
for ((i=$#gitout; i ; i--)) {
gitout[i]="${gitout[i]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${CMDR_GREEN}${match[1]}${CMDR_GREEN_E}
${(q-)match[2]} >${match[3]}<
${CMDR_MAGENTA}${(q-)match[4]}${CMDR_MAGENTA_E} ${match[5]}}"
}
print -rl -- +++++++++++++
print -rl -- for-loop: "${gitout[@]}"
--- 8< -- snip -- 8< ---
Messages sorted by:
Reverse Date,
Date,
Thread,
Author