help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: Extending regexes
Date: Wed, 06 Jul 2022 10:03:29 +0000	[thread overview]
Message-ID: <f5bd2dda-5392-4da8-b817-ec17e39a8049@www.fastmail.com> (raw)
In-Reply-To: <1754611311.1326396.1656963688860@mail2.virginmedia.com>

Peter Stephenson wrote on Mon, 04 Jul 2022 19:41 +00:00:
>> On 04 July 2022 at 20:15 Bart Schaefer <schaefer@brasslantern.com> wrote:
>> On Mon, Jul 4, 2022 at 6:53 AM Peter Stephenson
>> <p.w.stephenson@ntlworld.com> wrote:>
>> > > On 04 July 2022 at 13:03 Sebastian Gniazdowski <sgniazdowski@gmail.com> 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.

"X and not Y" isn't chaining; it's a Cartesian product.  Essentially one
walks both the X machine and the "not Y" machine simultaneously and
accepts iff both of them accept.

Chaining machines would create a non-deterministic machine that matches
the concatenation of the input machines' languages.


(backlogged, so, replying out of order)

> 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

  reply	other threads:[~2022-07-06 10:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 12:03 Sebastian Gniazdowski
2022-07-04 13:47 ` Peter Stephenson
2022-07-04 19:15   ` Bart Schaefer
2022-07-04 19:41     ` Peter Stephenson
2022-07-06 10:03       ` Daniel Shahaf [this message]
2022-07-06 18:40   ` stephane
2022-07-06 23:07 ` Phil Pennock
2022-07-07  0:22   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5bd2dda-5392-4da8-b817-ec17e39a8049@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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