compatibility guide

grep Regex: Syntax differences explained

Learn the important differences between grep regex and JavaScript regular expressions before reusing a pattern.

Last reviewed:

grep regex is not always JavaScript regex

grep may use basic regular expressions, extended regular expressions with -E, or PCRE-style syntax with -P when available. Those dialects do not share every feature, escape rule, flag, or Unicode behavior with JavaScript.

Common differences to check

Use this tool accurately

The Regex tester evaluates JavaScript (ECMAScript) expressions. It is useful for learning the shared concepts, but it is not a claim of grep-engine compatibility. Test production grep commands in the command environment that will run them.