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 16813 invoked from network); 7 Mar 2023 01:43:17 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 7 Mar 2023 01:43:17 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 3E29E41218; Tue, 7 Mar 2023 11:43:15 +1000 (AEST) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) by minnie.tuhs.org (Postfix) with ESMTPS id 0ACDD41202 for ; Tue, 7 Mar 2023 11:43:12 +1000 (AEST) Received: by mcvoy.com (Postfix, from userid 3546) id A9BFF35E921; Mon, 6 Mar 2023 17:43:11 -0800 (PST) Date: Mon, 6 Mar 2023 17:43:11 -0800 From: Larry McVoy To: Dan Cross Message-ID: <20230307014311.GN5398@mcvoy.com> References: <8d1de5c8-1f34-3d37-395d-0f1da7b062ec@spamtrap.tnetconsulting.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Message-ID-Hash: SRZ3FVQZBNLW5IHD27BV4FQMISWTDDQI X-Message-ID-Hash: SRZ3FVQZBNLW5IHD27BV4FQMISWTDDQI X-MailFrom: lm@mcvoy.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: 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: On Mon, Mar 06, 2023 at 04:01:51PM -0500, Dan Cross wrote: > On Mon, Mar 6, 2023 at 5:02???AM Ed Bradford wrote: > >[snip] > > I would like to extend my program to > > any date format. That would require > > a much bigger RE. I have been led to > > believe that a 50Kbyte or 500Kbyte > > RE works just as well (if not > > as fast) as a 100 byte RE. I think > > with parentheses and > > pipe-symbols suitably used, > > 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. > > 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 > what you'll end up with is an unreadable mess; it's like people who > abuse `sed` or whatever to execute complex, general purpose programs: > yeah, it's a clever hack, but that doesn't mean you should do it. Dan, I agree with you. I ran a software company for almost 20 years and the main thing I contributed was "lets be dumb". Lets write code that is easy to read, easy to bug fix. Smart engineers love to be clever, they would be the folks that wrote those long RE that worked magic. But that magic was something they understood and nobody else did. Less is more. Less is easy to support.