Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Extending regexes



> 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