Re: [Cbor] Regular expressions

Joe Hildebrand <> Sun, 28 February 2021 23:34 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id A43963A0D8E for <>; Sun, 28 Feb 2021 15:34:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 0.203
X-Spam-Status: No, score=0.203 tagged_above=-999 required=5 tests=[DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: (amavisd-new); dkim=neutral reason="invalid (public key: not available)"
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 6Dc1BamG456h for <>; Sun, 28 Feb 2021 15:34:23 -0800 (PST)
Received: from ( [IPv6:2607:f8b0:4864:20::32e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 3946A3A0D8C for <>; Sun, 28 Feb 2021 15:34:23 -0800 (PST)
Received: by with SMTP id g8so11096254otk.4 for <>; Sun, 28 Feb 2021 15:34:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eybY2h346KLTdYtupDeC+LN45P774CQxTrAD0GKtIBY=; b=GlOYXfFY5rianMJvc3PpCTN6uUxiYW+hYiGKhGQ2c9oy+eyNjGvUL+EVQgGqx7+TkE UCN0t0qTpDwNoEKtEmTXvPHTfejEO6sWFTeo26QZBoL9g89D2TAnjNppKd04A7RkzMhq gmS0WP5WQDFOi0C1bn2b+9Zp+FjDH7XPJ8aUc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eybY2h346KLTdYtupDeC+LN45P774CQxTrAD0GKtIBY=; b=pQIvMZBSKToiufvCNvsAb1OaQOQ0iYkji/0eEVpVBf+TD4wbFDC0Z9fXP0dhkcr6YM jUAkzZ3E5ldzwaZHbr+I2kVMRNKaP6B5vXO8IkFsRWZzMKismgTYLE8tZA7+XUFrX2QY fggSTRUxTZsWG4XCpfg2sNMnGQOGV7713W8TevQJsHuE5VMk4G94NxK2KmI7LxQAFfGU TzVwhWOr9VKGLiJmu6p6k3z+j0doAE/RLSj9Lz0/vCBNjAuY79bSgPzYhYkyRgnpORVE uIhqUtE9e2fIg1jZ26ocChQ/BB4DwVnaP9hvoYjK4incSx6WlSg/bqjpuE9JBPuvkeLo 88Ig==
X-Gm-Message-State: AOAM532KusiaMPPaQVz3EVdTA1FeDZ36KaHhQWhiT924dg/V91RH4DtD 3N7JoPEfr6X19Kvdp+CXIVCFiw==
X-Google-Smtp-Source: ABdhPJxyLk4K+IunNtF8ZRVeISh4fPsW5/GF0foL3UpkFA1f2fhZ8FpUpj28/kTz6wsFYQoTruqX1g==
X-Received: by 2002:a9d:19c9:: with SMTP id k67mr6730713otk.76.1614555261308; Sun, 28 Feb 2021 15:34:21 -0800 (PST)
Received: from ?IPv6:2601:282:200:3758:878:7598:b37e:7e3f? ([2601:282:200:3758:878:7598:b37e:7e3f]) by with ESMTPSA id b17sm3081382ook.21.2021. (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Feb 2021 15:34:21 -0800 (PST)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.\))
From: Joe Hildebrand <>
In-Reply-To: <>
Date: Sun, 28 Feb 2021 16:34:19 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <>
References: <> <> <> <>
To: Carsten Bormann <>
X-Mailer: Apple Mail (2.3654.
Archived-At: <>
Subject: Re: [Cbor] Regular expressions
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sun, 28 Feb 2021 23:34:25 -0000

> On Feb 28, 2021, at 4:24 PM, Carsten Bormann <> wrote:
>> In ECMAscript land 'gimsuy' are all valid.
> But g, for instance, is not an RE modifier.  It modifies how the operations are using it, but not the RE itself.  Similar for y.  u is really enabling syntax for decoding unicode, so it should not be visible during interchange (of the decoded RE).

Hm.  I understand your point, but round-tripping the objects intact is more important to me than which part is technically part of the regex.

>> Nod.  We'd probably need a small registry then, with the names or a code.  I would expect the semantics are "use this if it's a type you know about, otherwise, keep the tagged version and punt to the application layer".
> Right.  But why not use tags for those?  We already have that registry.
> (We could write a common document that we expect new RE tag registrations to reference, so there is some structure to this.)

That works for me.  So, there would be an "ECMAscript RegExp" tag then, right?

>> No argument, but I use regex's every day, and ABNF or a full PEG grammar just when I need to get out the big hammer.
> REs are certainly more amenable to interchange as such.
> I need to fix up my ABNF to RE compiler…
> (Which is almost trivial – as long as the ABNF is not recursive – but the current version generates way too much noise that a manual RE writer would know how to avoid.)
> I’m also on the lookout for a toolkit for translating between the various RE dialects.

I bet the regex101 folks have a starting point for that.  Does anyone have a contact there?

BTW, one of the reasons all of this has come up for me is I've been tinkering with Basura (, a library/CLI for generating random trash JS that is syntactically valid, but otherwise useless.  I just released it this morning, and I've learned a few interesting things about my CBOR implementation by tying the two together.

Joe Hildebrand