Hacker News new | ask | show | jobs
by giraffe_lady 1514 days ago
I write regex all the time and I can't read a regex. It's a powerful tool and that's a very valid complaint about it.
3 comments

A regex can be difficult to parse, especially if it is very involved, but in Perl at least, there are ways to make it much easier ( using the /x modifier, for example : https://perldoc.perl.org/perlre#%2Fx-and-%2Fxx ). Comments and and having the regex itself be multiline can make things better, especially if you are creating a particularly complicated one.

Damian Conway highly recommends using the combo of 'xms' his Perl Best Practices Book ( https://www.oreilly.com/library/view/perl-best-practices/059... ).

The revised and considerably newer "Modern Perl Best Practices" video series on O'Reilly's learning platform is particularly good also ( https://www.oreilly.com/library/view/modern-perl-best/978149... ) - with lots of discussion of regexes.

Part of the fun of regex is learning to make sense of what looks like black magic

I imagine asm programmers feel the same way

fwiw I think this world needs less "it's too hard for me" and more "let me roll up my sleeves and dig into this"

> fwiw I think this world needs less "it's too hard for me" and more "let me roll up my sleeves and dig into this"

I’m gonna need a hell of a lot more of my time back for that.

if my companion says "I am cold" on a warm day in the shade, then it is a valid complaint, since they probably do feel cold. You express empathy for the readers with "valid complaint" and from an educational, empathy point of view, sure, agree. Are regex's used by more people, or less people, than in 1999? Do people read, write and use them in code? for editing HTML pages? of course it is trivially true. That guy was saying to software developers "don't use regex it is a problem not a solution" .. I was there!