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=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31999 invoked from network); 3 Mar 2023 17:13:58 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 3 Mar 2023 17:13:58 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id D066B43295; Sat, 4 Mar 2023 03:13:56 +1000 (AEST) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by minnie.tuhs.org (Postfix) with ESMTPS id 441CB4328E for ; Sat, 4 Mar 2023 03:13:52 +1000 (AEST) Received: by mail-lf1-x12a.google.com with SMTP id i28so4564200lfv.0 for ; Fri, 03 Mar 2023 09:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H3bbYTGIe06ao0WX5fzj+pXQpUW1tt6XYu1R8IGR4ko=; b=pi6mKHTiUFirwrox67ERc8U8zGmSXHmRP5BgH8Smza0pfK7FnSq/uL/eWA6H1RgISt FbmdqiYL3X0meDEKoM/2Zjy3IctD3otEuLjrNdUcMzHB3E9+3a/HuzeIjPJGpvAnW7OQ pCVAxytV1QyVmOz8SF68j+Ux+3qU7iZvO6K6Fhccf/cegjlTyLSncuRByDEzVDnPink0 vq60/z0QgpiBR2LXi6O7N97noVHiUThG+h9Tw7lioiUwE4+6Zif7j7HL1aX3psE+4Ygn Yt/lXuMDLKTRHsndOZBhUmdrcb2gfeMXPzLoYGKBwWysdEh/NuC02aWe714a+pIoCMDY jxJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H3bbYTGIe06ao0WX5fzj+pXQpUW1tt6XYu1R8IGR4ko=; b=O4bL386BDLDStu3IiPRdQK9ZeHr+fPDeN67VqSo3yvBVZkFUKfDZmDCc31+9MLd8C0 dUOfhhtOqzq+6wwwMV+ZMjs0+mrvJc/SnWok/2znrJxcQzJzULgApGVtxnzVkRv68uFV qBeqCfgtDxpLx4dHtsBh49makZW5oKf509Geqb+jOd5iELCGzRc/zf9zfx1zLyyARW3g LCYHTZQiOfx4KwOD/QomdZC+kv0ADmK5wYr3XH0dQ0FHUfe6DfhSZzD1i69SrRrtRSSw P1NfNyr0vqC8sDoYR46YXULPPncVod2FkA9TBVnsYrFtzyoYDIry3rin5hJl+lmdJDt2 SOpg== X-Gm-Message-State: AO0yUKV37Ff3O7dWp9gIXUbtiMXg4yBUJfpr72ZlpsUaahd+c+q1d12p Cg+ZkCjC7LS20P1VrWzNbpKnnhXyyS7tGgoD4rcR0v9NDAE= X-Google-Smtp-Source: AK7set89r/iW3XgGmGD4tq0KZCwZ4yvkwMyikKZaucABN2OBqk6OTPUNYP0Gys0af0rtDUXve2Nt+q7HsLRYq62drew= X-Received: by 2002:ac2:4c37:0:b0:4db:2554:93a6 with SMTP id u23-20020ac24c37000000b004db255493a6mr847594lfq.10.1677863629997; Fri, 03 Mar 2023 09:13:49 -0800 (PST) MIME-Version: 1.0 References: <8d1de5c8-1f34-3d37-395d-0f1da7b062ec@spamtrap.tnetconsulting.net> <20230303105928.E88AB215AA@orac.inputplus.co.uk> In-Reply-To: From: Dan Cross Date: Fri, 3 Mar 2023 12:13:13 -0500 Message-ID: To: Dave Horsfall Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZTJI3IGRLAS5GZJY4FFXC6K6URITIKXP X-Message-ID-Hash: ZTJI3IGRLAS5GZJY4FFXC6K6URITIKXP X-MailFrom: crossd@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Computer Old Farts Followers X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [COFF] Re: Requesting thoughts on extended regular expressions in grep. List-Id: Computer Old Farts Forum Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, Mar 3, 2023 at 11:12=E2=80=AFAM Dave Horsfall w= rote: > [snip] > # Yes, I have a warped sense of humour here. > /^[JFMAMJJASOND][aeapauuuecoc][nbrrynlgptvc] [ 0123][0-9] / \ > { > date =3D sprintf("%4d/%.2d/%.2d", > year, months[substr($0, 1, 3)], substr($0, 5, 2)) If I may, I'd like to point out something fairly subtle here that, I think, bears on the original question (paraphrased as, "where does one draw the line between concision and understandability?"). Note Dave's class to match the first letter of the month: `[JFMAMJJASOND]`. One may notice that a few letters are repeated (J, M, A), and one _could_ shorten this to: `[JFMASOND]`. But I can see a serious argument where that may be regarded as a mistake; in particular, the original is easy to validate by just saying the names of the month out loud as one scans the list. For the shorter version, I'd worry that I would miss something or make a mistake. The lesson here is keep it simple and don't over-optimize! > Etc. The idea is not to validate so much as to grab a line of interest t= o > me and extract the bits that I want. > [snip] Too true. A few years ago, Rob Pike gave a talk about lexing in Go that bears on this that's worth a listen: https://www.youtube.com/watch?v=3DHxaD_trXwRE - Dan C.