[GTALUG] Hardcore sed foo

Giles Orr gilesorr at gmail.com
Fri Nov 8 11:41:02 EST 2019


On Thu, 7 Nov 2019 at 23:26, Anthony de Boer via talk <talk at gtalug.org>
wrote:

> Lennart Sorensen via talk wrote:
> > On Tue, Nov 05, 2019 at 06:42:44AM -0500, Giles Orr via talk wrote:
> > >  ...
> > > Jeez regex is a pain - it took three minutes of staring at that just to
> > > figure it out, even though I knew what we were both trying to achieve.
> >
> > Practice time!
> >
> > https://regexcrossword.com
>
> Oooh, fun!  The Hamlet puzzle took a few minutes to sort out.  But
> then I'm not a regular crossworder.
>
> One of the guys I work with claims that any use of regexen requires
> multiple lines of comment to explain, but I'm firmly of the opinion
> that being able to sight-read them is a basic Unix programming skill.
>

Eyeballing simple regex is hard enough, but mentally parsing out a complex
full line regex that looks like inline garbage without the benefit of
comments isn't something I recommend or appreciate.  Some forms of regex
support comments within the regex itself:

https://www.regular-expressions.info/freespacing.html

However ... "Of the flavors discussed in this tutorial, only ... the POSIX
and GNU flavors don't support it."  Which is where I most need it.  Of
course, you can still make standard shell script comments before or after
the 'sed' block, and I'm very much in favour of those.

-- 
Giles
https://www.gilesorr.com/
gilesorr at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20191108/72918c64/attachment.html>


More information about the talk mailing list