From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17204 invoked from network); 4 Jul 2022 12:03:57 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Jul 2022 12:03:57 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1656936237; b=Ib+zfMqgLMuxSObvaiRUR6zo2axprh9H7MNM8Y8kXkKcRvIpqBvQ1SCim0QpDDMLVolfv5gP4D 1tKFVKC+CiNQQ6eagJJl73apC3SUNLEMLDg2J+E8PHLtmUTWOEoC2p0CzyLNLqR91xyvfezecq TEl14l8Qqheap6EeZ+aiw4zJy4rKaoorUiDWinELfq3E2SlOpwNChTBLt9/Xk/ibdOmpRIWtqd xnSF9yAB1BnjQ2q+mjsy+0sKa4cVwb+uDgDm5B6sCLP3RtRYneFdxESVti1hDrC90zu4RSqdck +40vhyGJzuyPn31WIxspaO1+86Geow2TivzzfK6JXo6/eg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vk1-f171.google.com) smtp.remote-ip=209.85.221.171; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1656936237; bh=798YRO+RV4Kontw/8gmE/AO4pUxmlImlAAP+M3SENuM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=Iz7g+z71CNu7NZJELJh3bgwuqK8KvRGZFkVy/qcHPs9ZEim2/JgznxDaacLmPL3U1s+JW/1z5u lkAYeaElsXYQ8Pu8aBeafRi71X+c/6zTN14PqrCT3OSATxEVH+9N6CnlfsUzVsEBDE16luOmmY Bd7wypAOO5HCO4PKa8KMwunLg4rzuHKWgLPHGX/ZMyfrax5VCwYpqVEedzR3ga0wnAdMh1JaCh iLDGU79J925GfXHImLHlbe2lhnIOl1WowPjdqNCkg3LScrmsnDsFce5t6oQKcn5AlxK//cJH7g mqf6VbDe+WR/H4VVF9nmxLR6qXOq0TZs4H9LtTdqC28uRA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=CYeD80KvO2OoFlv/fMZ5BRRKK1aFdnczdsb7h30eAz8=; b=OexNyq+CURXTj4zpfGXIM0aFBh X5wkP0s4TevPb+uvR0Mw5I2Zh6zLq6DTRXjKqzZYDh9KpWPrcht2LNWIjDs8fZhQ8r88vqpmOHMNR HAB9yOis/U5maCRm4BMvgIMfztUUHa+1zhHexkDrAKtAXlfw/UeEkaNA8wRPtXwvwRyglZ2SDlc4j 1SDs53oFoAMeWZc3AlG66J1JTE8eGaisVbuSpDw4iBJRhC44qZBm+XAu413BaSQZdF1gavWWe52Wv noMDxuiVAownZe9zhG7tPW8UtbfYYR+jxvhikH4AGDXpZMEQerCnjoSvjsMHTPVeKqVjTq9sQsKaU U39zumYQ==; Received: from authenticated user by zero.zsh.org with local id 1o8Ko0-0008KR-Et; Mon, 04 Jul 2022 12:03:56 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vk1-f171.google.com) smtp.remote-ip=209.85.221.171; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vk1-f171.google.com ([209.85.221.171]:41494) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1o8Knh-000804-Vx; Mon, 04 Jul 2022 12:03:38 +0000 Received: by mail-vk1-f171.google.com with SMTP id r1so4313337vke.8 for ; Mon, 04 Jul 2022 05:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=CYeD80KvO2OoFlv/fMZ5BRRKK1aFdnczdsb7h30eAz8=; b=f2gxBi1xvp8l34pyEkLfxSF5KkWrwg9t0LwKZuikPMGQALtbwuZ9lA56KO+xcEaRFd EEhepjTqAYacLY/cDycy52Lv4M+vyfuezPXB/U+trjLnSM4MpHxNJM8SGzm3ZKiQ5FWd ixIaxySmWgoSS7u9jMWuOxj6JGjxT7pORl6235VG396pbLpSFMUzFonGccmXxkIvEQ+K enL2X0y1c2XfigPWlWl0kY/aBZ8AH8p+iS1JiH1YnCFwWI8Y76HHlHPpJCV44u5wU5/v 37npvfzhVZchNwbkHOD9c8xFJMArSjfvEauz3XK0v9ZH7YOh3b4XXL7SBKCWwVIKXlNb MNvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CYeD80KvO2OoFlv/fMZ5BRRKK1aFdnczdsb7h30eAz8=; b=nkgTllot25aKVXue059rL+CK2CjB40MHtTFPq2fYOMd043lCzk9ujdNDK08xPcrP6l 1k7V88it2VHrZ5qqKeKDv5Nqu0N8nOkDpG4hPfjH2JtJ9ScoGttJa1Q3+KugakG9nhOX MTpTcoSAna6xcCTr2xFjjkC2wMsM+tk0YbaUwtwPloQqKYN99pbnSszvguWfWtY+hjHX YJZTduRRUwVsmMKhE7C79lIhOR6V7Oruvh0dR1/lGyhswYzqLc6UrRCq5OJlayoHjPib kZfLlj/I1QJNoZUnweXoXiiq9XvP6K0BNb/RZN7hZ76vF1QCBaXaWKrPVBz4MJOq43Kt OvLQ== X-Gm-Message-State: AJIora8SSVeP3sw1xAt3R8rPzV1jKHTM1NvBgispDVEm3N7mAy1O5U8A 9pyqYSvwKulyHfxrjDi4hYkxX1Jtx4jqlYcCH/LueCbK X-Google-Smtp-Source: AGRyM1typW25TgMn6uZLY+q54d4rx6fW8jvE0hi12rngMvfzPqUlkHXIwXuz53pDOXpg3eTkiV6D8Pvr7kCpOH8g+YM= X-Received: by 2002:a05:6122:2023:b0:36c:729f:7300 with SMTP id l35-20020a056122202300b0036c729f7300mr15820022vkd.24.1656936216561; Mon, 04 Jul 2022 05:03:36 -0700 (PDT) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Mon, 4 Jul 2022 14:03:24 +0200 Message-ID: Subject: Extending regexes To: Zsh hackers list Content-Type: multipart/alternative; boundary="0000000000009a8bbd05e2f986ef" X-Seq: 50400 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --0000000000009a8bbd05e2f986ef Content-Type: text/plain; charset="UTF-8" Hi, Zsh has extensions to regular regexes - the ~ and ^ negations. They, as it can be expected from negations that are required by Turing universal machines, introduce a whole new universe of computations over standard regular expressions. For example matching in an AND fashion: If [[ ABC == *A*~^*B*~^*C* ]]; then print A, B and C found fi I think that regexes look pretty limited from this point of view and that pcre extensions went wrong path with the look forward and behind semantics. The typical, common attempts of using regex [^] negation like [^(string)] are simply there in zsh patterns as ^string. I've recently used ~ negation in a project to reject a set of known tokens from matching at given position with a great success to match a loose `for` syntax in an zinit-annex-pull extension to zinit that greps and extracts zinit commands from any web page. I cannot see it possible without the extra negation. 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? Could someone experienced with them like Oliver prepare some white papers to accomplish this? It would be a great event to extend the old regexes with such a great feature like not one, but TWO new negations. --0000000000009a8bbd05e2f986ef Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0
Zsh has extensions to regular = regexes - the ~ and ^ negations. They, as it can be expected from negations= that are required by Turing universal machines, introduce a whole new univ= erse of computations over standard regular expressions. For example matchin= g in an AND fashion:=C2=A0

If [[ ABC =3D=3D *A*~^*B*~^*C* ]]; then=C2=A0
=C2= =A0 print A,=C2=A0 B and C found
fi=C2=A0

I think that regexes look pretty l= imited from this point of view and that pcre extensions went wrong path wit= h the look forward and behind semantics. The typical, common attempts of us= ing regex [^] negation like [^(string)] are simply there in zsh patterns as= ^string.=C2=A0

I've= recently used ~ negation in a project to reject a set of known tokens from= matching at given position with a great success to match a loose `for` syn= tax in an zinit-annex-pull extension to zinit that greps and extracts zinit= commands from any web page. I cannot see it possible without the extra neg= ation.=C2=A0

Therefore I= thought that it's weird that such an useful feature is missing from th= e commonly used regex syntax. So maybe an attempt of updating it has sense?= Could someone experienced with them like Oliver prepare some white papers = to accomplish this? It would be a great event to extend the old regexes wit= h such a great feature like not one, but TWO new negations.=C2=A0
--0000000000009a8bbd05e2f986ef--