Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Extending regexes
- X-seq: zsh-workers 50401
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Extending regexes
- Date: Mon, 4 Jul 2022 14:47:39 +0100 (BST)
- Archived-at: <https://zsh.org/workers/50401>
- Importance: Medium
- In-reply-to: <CAKc7PVAa718cFk2n1W=oxgxxRh-DEs8Cjvc5sKpqe8C3D+M-ig@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKc7PVAa718cFk2n1W=oxgxxRh-DEs8Cjvc5sKpqe8C3D+M-ig@mail.gmail.com>
> On 04 July 2022 at 13:03 Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hi,
> Zsh has extensions to regular regexes - the ~ and ^ negations.
>
> Therefore I thought that it's weird that such an useful feature is missing
> from the commonly used regex syntax. So maybe an attempt of updating it has
> sense?
You're quite right both that they're very useful in zsh and there's nothing
like this in normal regular expressions, but unfortunately I've got a strong
feeling this is a big can of worms [hope that image is graphic enough that
I don't need to explain the phrase for non-native English speakers].
I say that as although I'm not very up on the mathematics of regular expressions
I did write the basics of the current zsh implementation of glob negations.
(Before that, there was an even less efficient implementation that created a
structure for each part of the pattern, which wasn't good for memory management
--- this is going back to the 1990s, I think.) There are some pretty pathological
details to make sure this works in every case, so I'd really want a real expert in
the subject area to think about this before it got much further.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author