* How to repel a space separated quoted strings with ~?
@ 2022-06-05 9:12 Sebastian Gniazdowski
2022-06-05 12:22 ` Sebastian Gniazdowski
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2022-06-05 9:12 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
Hi
Consider the following:
ice="a|b|c|d"
x="a b X c' x' d' e' Z"
if [[ $x = (#b)(((($~ice)*\ )#)((([^[:space:]]#)~(#B)(($~ice)*))\
))#((#B)(($~ice)*\ )##)(Z) ]]; then
pl $match
fi
Output:
a b X c' x'
a b X c'
a b X c'
a
x'
x'
x'
d' e'
Z
The goal is to match blocks of lower letters specified by ice var possibly
followed by a glued quoted strings and block of a capital letter. The
repel negation ~ is successful at preventing matching lower letters at the
capital paren however only if not glued by a string. Is there a way to
repel also such strings ?
The output should be:
...
...
...
c' x' d' e'
Z
[-- Attachment #2: Type: text/html, Size: 1530 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to repel a space separated quoted strings with ~?
2022-06-05 9:12 How to repel a space separated quoted strings with ~? Sebastian Gniazdowski
@ 2022-06-05 12:22 ` Sebastian Gniazdowski
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Gniazdowski @ 2022-06-05 12:22 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
the solution is to pre-split with Z flag then replace spaces with some
special char like mom breaking space then join then apply the pattern then
replace back
niedz., 5 cze 2022, 11:12 użytkownik Sebastian Gniazdowski <
sgniazdowski@gmail.com> napisał:
> Hi
> Consider the following:
>
> ice="a|b|c|d"
> x="a b X c' x' d' e' Z"
>
> if [[ $x = (#b)(((($~ice)*\ )#)((([^[:space:]]#)~(#B)(($~ice)*))\
> ))#((#B)(($~ice)*\ )##)(Z) ]]; then
> pl $match
> fi
>
> Output:
> a b X c' x'
> a b X c'
> a b X c'
> a
> x'
> x'
> x'
> d' e'
> Z
>
> The goal is to match blocks of lower letters specified by ice var possibly
> followed by a glued quoted strings and block of a capital letter. The
> repel negation ~ is successful at preventing matching lower letters at the
> capital paren however only if not glued by a string. Is there a way to
> repel also such strings ?
>
> The output should be:
> ...
> ...
> ...
> c' x' d' e'
> Z
>
>
[-- Attachment #2: Type: text/html, Size: 2052 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-05 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05 9:12 How to repel a space separated quoted strings with ~? Sebastian Gniazdowski
2022-06-05 12:22 ` Sebastian Gniazdowski
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).