Regular expressions that work “everywhere”
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A practical guide to identifying which regular expression features work across multiple tools — specifically sed, awk, grep, and Emacs. The strictest portable subset includes only literals, character classes, and basic special characters. Using GNU versions with the -E flag expands compatibility, with awk serving as the lowest common denominator. Emacs is the main oddball, requiring backslashes before metacharacters like +, ?, (, ), {, }, and | and using different whitespace class syntax. A consolidated list of features that work across all four tools is provided, including dot, anchors, character classes, quantifiers, alternation, capturing groups, backreferences, and word boundary markers — with a caveat about gawk's backreference support.