[COFF] Requesting thoughts on extended regular expressions in grep.

Larry McVoy lm at mcvoy.com
Tue Mar 7 11:43:11 AEST 2023


On Mon, Mar 06, 2023 at 04:01:51PM -0500, Dan Cross wrote:
> On Mon, Mar 6, 2023 at 5:02???AM Ed Bradford <egbegb2 at gmail.com> 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.


More information about the COFF mailing list