v160 · javascript · regexp

Annex B literal trap

The grammar adds \A, \z and \Z only under [+UnicodeMode]. Outside u/v, web-compat Annex B keeps treating them as identity escapes — the plain letters A, z, Z — so a pattern copied from Perl or PCRE without the flag compiles happily and silently means something else. Even the explainer’s own /end\Z/ example has no u. This page runs every edge case live.

Probing this browser…

Edge-case battery

Expected values are what the spec text says. Rows marked needs feature throw SyntaxError: Invalid escape on engines without buffer boundaries; that is reported as unsupported, not as a spec failure.

Each row: new RegExp(pattern, flags), then .test(input)
RegexInputSpec saysObservedVerdictWhy
Not run yet.
 

Compare with and without Unicode mode

 

migration checklist

see also