Sujet : Useless Use Of Regexes
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.miscDate : 24. Mar 2025, 21:34:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vrsfkv$1md7d$1@dont-email.me>
User-Agent : Pan/0.162 (Pokrosvk)
Besides the traditional “Useless Use Of Cat” (UUOC) newbie faux pas,
we can add “Useless Use Of Regexes”.
These can often be quite subtle. I spotted one obvious instance here
<
https://www.zdnet.com/article/5-ways-i-use-regex-in-linux-and-why-theyre-so-essential/>,
namely this one:
ip addr | grep -Eo '192\.168\.1\.[0-9]{1,3}'
which can be more easily written using features built into iproute2 itself:
ip addr show to 192.168.1.0/24