3 ms·
It's similar to the misunderstanding about Knuth's optimization quote. Regex isn't bad, regex is bad when it's used thoughtlessly (like most tools, but worse t
by Jtsummers 11y ago
It's similar to the misunderstanding about Knuth's optimization quote.
Regex isn't bad, regex is bad when it's used thoughtlessly (like most tools, but worse than many because it's so information-dense that errors and misapplication may be non-obvious). Use regex to recognize strings. Don't use regex to recognize grammars. (A particularly common abuse of regex.) Break your regular expressions up either visually (if your language allows it) or into multiple expressions so that they're clearer and more easily understood and changed.