Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Extending regexes
- X-seq: zsh-workers 50403
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Extending regexes
- Date: Mon, 4 Jul 2022 20:41:28 +0100 (BST)
- Archived-at: <https://zsh.org/workers/50403>
- Importance: Medium
- In-reply-to: <CAH+w=7bey3h8XzyxXcYiOXx3yzYk50cjm5t4yt5kGNWB-6XJdw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKc7PVAa718cFk2n1W=oxgxxRh-DEs8Cjvc5sKpqe8C3D+M-ig@mail.gmail.com> <76883431.1281129.1656942459330@mail2.virginmedia.com> <CAH+w=7bey3h8XzyxXcYiOXx3yzYk50cjm5t4yt5kGNWB-6XJdw@mail.gmail.com>
> On 04 July 2022 at 20:15 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mon, Jul 4, 2022 at 6:53 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:>
> > > On 04 July 2022 at 13:03 Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> > > Zsh has extensions to regular regexes - the ~ and ^ negations.
>
> PWS correct me if I go too far astray, but (^Y) is internally (*~Y)
> and (X~Y) is implemented by first matching (X) and then removing
> anything that matches (Y) ... which is where the regular-ness goes
> astray. My formal training on this is more than a little rusty, but I
> believe this means chaining together two finite-state machines rather
> than building a single one.
That is basically how they're implemented. We have a sort of internal
scratchpad that allows us to backtrack over the exclusions as a nested
state of the main pattern match. You're entitled to say 'ick' at this
point.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author