v160 · javascript · regexp
Buffer anchor tester
Type a pattern that uses \A, \z or \Z, pick flags, and feed it input with real line breaks. Every result below comes from new RegExp(pattern, flags) in this browser — including the SyntaxError when the engine does not know the escapes.
Try a pattern
Press “Run pattern”.
Strip: each box is one input character (\n shown as a grey box); dark boxes are matched characters; a blue bar marks a zero-width match position.
The explainer’s truth table, run live
The proposal README lists nine expected results for /\Afoo|^bar$|baz\z/um. This runs the same nine inputs against your current pattern and flags and compares with the README when they match the original.
| Input | Expected | Observed | Verdict |
|---|---|---|---|
| Not run yet. | |||
what to notice
^bar$matches"\nbar"becausemmakes^a line anchor;\Afoorefuses"\nfoo"because\Aignoresm.baz\zrefuses"baz\n":\zis the absolute end. Swap it for\Zto allow one trailing line break.- Untick
u: the pattern now compiles everywhere, but\Ameans the letterA.