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=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20367 invoked from network); 6 Mar 2023 21:49:16 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 6 Mar 2023 21:49:16 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 082CE4121E; Tue, 7 Mar 2023 07:49:14 +1000 (AEST) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id 4C5AD41218 for ; Tue, 7 Mar 2023 07:49:09 +1000 (AEST) Date: Mon, 06 Mar 2023 22:49:05 +0100 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Dan Cross Message-ID: <20230306214905.vK5oe%steffen@sdaoden.eu> In-Reply-To: References: <8d1de5c8-1f34-3d37-395d-0f1da7b062ec@spamtrap.tnetconsulting.net> Mail-Followup-To: Dan Cross , Ed Bradford , Grant Taylor , COFF User-Agent: s-nail v14.9.24-432-g67dd7ec606 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GSMHSJHDYD2P2YRUF4CBZ3NXH2X6JWVW X-Message-ID-Hash: GSMHSJHDYD2P2YRUF4CBZ3NXH2X6JWVW X-MailFrom: steffen@sdaoden.eu 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: Grant Taylor , COFF 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: Dan Cross wrote in : |On Mon, Mar 6, 2023 at 5:02=E2=80=AFAM Ed Bradford wr= ote: |>[snip] |> I would like to extend my program to |> any date format. That would require |> a much bigger RE. I have been led to ... |> one could match |> |> Monday, March 6, 2023 |> 2023-03-06 |> Mar 6, 2023 |> or ... |This reminds me of something that I wanted to bring up. Me too. If it becomes something regular and stable maybe turn into a dedicated parser. (As a lex yacc bison byacc refuser, but these surely can too.) |Perhaps one _could_ define a sufficiently rich regular expression that |one could match a number of date formats. However, I submit that one |_should not_. REs may be sufficiently powerful, but in all likelihood ... Kurt Shoens implemented some date template parser for BSD Mail in about 1980 that was successively changed many years later by Edward Wang in 1988 ([1] commit [309eb459e35f77985851ce143ad2f9da5f0d90da], 1988-07-08 18:41:33 -0800). There is strftime(3), but it came later than both to CSRG, and the Wang thing (in usr.bin/mail/head.c) is a dedicated thing. (Ie /* Template characters for cmatch_data.tdata: * 'A' An upper case char * 'a' A lower case char * ' ' A space * '0' A digit * 'O' An optional digit or space; MUST be followed by '0space'! * ':' A colon * '+' Either a plus or a minus sign */ and then according strings like "Aaa Aaa O0 00:00:00 0000".) [1] https://github.com/robohack/ucb-csrg-bsd.git --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)