When Are Regexes Appropriate?


Regular expressions are useful enough that they’re built in to the syntax of the shell. But they’re not always the right tool. Here’s my off-the-cuff heuristics for when to use them.

If there is any sort of arbitrary nesting (like nested quotes and parens) and you need perfect accuracy on all sorts of inputs, don’t use regex.

If the input isn’t pathological, if accuracy isn’t required, or if you need speed, use regex.

Related Posts

Just because 2 things are dual, doesn't mean they're just opposites

Boolean Algebra, Arithmetic POV

discontinuous linear functions

Continuous vs Bounded

Minimal Surfaces

November 2, 2023

NTK reparametrization

Kate from Vancouver, please email me

ChatGPT Session: Emotions, Etymology, Hyperfiniteness

Some ChatGPT Sessions