Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request (#b)...(...)<not empty>
- X-seq: zsh-workers 40632
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <psprint2@xxxxxxxxxxxx>
- Subject: Re: Feature request (#b)...(...)<not empty>
- Date: Sat, 25 Feb 2017 15:13:15 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=/4qj0dzleJ47lTI bmW32WmsAr4s=; b=nPnuBDOSKKAl/ug9ua704geY2gnYzkYOv7F+Fn52h6joe2x vtWR68x6O1THKK1TAsHfXspVYaZC51exSlL1ohiUd8uvoC/vTcfkr878CyNIjQkD teL1GfE9rsE5RaivLvInBfYTIIrgcxiPYpHu0zuzC1Xjc3e1Se+nsClH1oGQ=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=/4qj0dzleJ47lT IbmW32WmsAr4s=; b=LdUoV0c/WHzR+Y4QV12uTieqedm/RvCmWXU1LjLxb/ocwN LN3SaUhCMDA9gyFvsHGzDkmlmE68Vdi0BQjAebzl9TAzX0g2y2EzObT515fLZYrf SXLmrBEtCFr/iYTZb2lkpQg10IM3fq3hsez/h9BbTtaMe2kJ31ByDNHiDpbuo=
- In-reply-to: <1488011830.2241447.892433784.52D183B6@webmail.messagingengine.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: <1488011830.2241447.892433784.52D183B6@webmail.messagingengine.com>
Sebastian Gniazdowski wrote on Sat, Feb 25, 2017 at 00:37:10 -0800:
> Hello,
> found a limitation in regex-like specification, maybe it's easy to add
> extension?
>
> A pattern: (a|)(b|)(c|). Order of a, b, c matters, but any combination
> of them will be accepted. The problem: |) in all three will also be
> accepted. That's not a combination of a, b, c. This is onset of
> something higher-level: "combination of".
>
> So maybe: ((a|)(b|)(c|))(#n). #n is for not-empty, resembles [[ -n.
>
> It looks like typical pattern situation: try something, decide if to
> reject it. So maybe it's easy to add?
Some regexp flavours support zero-width lookahead, which would allow
this. For example, in Perl,
% print -l {a,}{b,}{c,} | perl -lnE 'print if /(?=.)(a|)(b|)(c|)/' | wc -l
7
However, I have no opinion as to whether that should be added: I don't
know how much effort would be involved, and for the given example there
are alternative solutions that require no syntax changes.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author