June 27, 2026

Love letters and hate mail for regex

Regular expressions that work "everywhere"

One coder tried to make pattern-matching finally behave, and the comments went feral

TLDR: The article tries to find a small set of search-pattern features that work across common tools, so shared code breaks less often. Commenters agreed the problem is real, but argued hard over missing caveats, hidden switches, and whether the author was just rediscovering old standards.

A programmer set out to solve one of computing’s most annoying little soap operas: why the same search pattern works in one app, then completely falls apart in another. The article’s big idea is simple enough for non-experts: if you’re sharing code with coworkers or using locked-down machines where you can’t install your favorite tools, you need a safe, boring set of pattern rules that work in lots of places. The author’s answer is basically, “aim low, stick to the common stuff, and treat one old-school tool as the baseline.” Sensible? Yes. Peaceful? Absolutely not.

The comments instantly turned into a pedantry cage match. One camp basically yelled, “This is why you must say exactly which pattern language you mean!” Another swooped in with the classic gotcha: some common symbols don’t even work by default in tools like grep unless you flip the right switch first. Translation for normal humans: even the so-called “simple” version may already be too optimistic. Then came the academic flex, with one commenter casually dropping a research paper about patterns that behave the same under different matching styles, because of course regex discourse can turn into homework at any second.

And then there was the driest mic-drop of all: one commenter basically said the author was one sentence away from admitting the answer has existed for ages in official standards. The funniest reaction? A deadpan “why I built this,” which reads like every developer who got burned one too many times and decided to start a side project out of spite. In other words: the article offered survival tips, but the community served the real entertainment — a glorious mess of corrections, standards snobbery, and “actually…” energy.

Key Points

  • The article says regex portability is difficult because implementations differ across tools in supported features and syntax.
  • The strictest cross-tool regex subset identified by the author includes literals, character classes, and the special characters `.`, `*`, `^`, and `$`.
  • For the author’s practical definition of portability, the main target tools are sed, awk, grep, and Emacs.
  • Among GNU sed, GNU awk, and GNU grep, the article presents awk as the lowest common denominator when sed and grep are used with `-E`.
  • The article concludes with a practical list of regex features the author says work across their chosen tools, with caveats for Emacs syntax and awk word boundaries.

Hottest takes

"why I built this" — Resonix
"You must be specific about which regex language your thing accepts" — MathMonkeyMan
"`-E` is required to fix that behavior" — LoganDark
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.