"Regex" is the small name of Regular expressions
Regex are one of the superpowers 💪 of Perl
It's a productivity superpower the same way knowing command line shortcuts and mastering vim.
Damian Conway is a master of regular expressions but you can sometimes feel the pain in his mouth when he discusses regex
It could be strange to advocate a wrong thing but sometimes you just don't need more than a one shot program, and for me it would be dumb (or irresponsible) to spend more time than needed just "for the sake of correctness".
I know it's not really the hype of these days where over engineering is better perceived than KISS principles (I exaggerate just a little) but it is pragmatism.
Regex are bad, everybody knows, and here is the very famous SO answer "You can't parse [X]HTML with regex" about that 😀
Some people have played the "devil's advocate" and came with regex for XML like this great answer from Tom Christiansen where he used regex to tokenize then Perl to parse.
Seems also like PCRE are more than simple regular grammars but actually I can't say if mathematically Perl regex can or can't parse XML, regular expression page on wikipedia says that
Another interesting old link on this topic is REX. The abstract of it is
The syntax of XML is simple enough that it is possible to parse an XML document into a list of its markup and text items using a single regular expression. Such a shallow parse of an XML document can be very useful for the construction of a variety of lightweight XML processing tools
(I do not quoted this one on a picture since I'm too afraid to awake Cthulhu)
While use of complex regex are subject to discussions, there are perfect and obvious use cases for regex:
- Validation of input
- Cleaning of input
- Restructuring of input
- Looking for substrings within input
I wanted to finish with this crazy fact, fasten your seat belts.
This is mad.