Parser FAQ
Which regex flavors does it parse?
The parser supports ten flavors, including PCRE2, JavaScript, Python, Java, and .NET. See Capabilities for all identifiers and syntax coverage.
Where does regex101 use it?
regex101 uses the parser for syntax highlighting, syntax errors, and explanations. The same package parses substitution text in the editor.
What does a parse return?
Each parse returns source text, typed tokens, parser state, and a patternError status. Tokens include source positions and syntax-specific facts.
See Parse result for the result shape.
Does it support incremental parsing?
Each new parse processes the full input. The parser can reuse cached results for repeated calls with the same input and options.
Does parseSubstitution apply the substitution?
No. It parses and validates substitution syntax. Your regex engine must match the pattern and apply the substitution.
Is AST documentation available?
The package exports TypeScript unions for regex and substitution tokens. Use the declarations supplied with your package version as the token schema reference.
Does it include linting?
The parser reports syntax errors. It does not lint style or assess ReDoS risk.
Does a valid parse guarantee that the engine accepts the pattern?
No. The parser does not compile or run the pattern. Verify matching behavior in your target engine.
Can it be used in browser and Node.js?
Yes. The package provides ESM and CommonJS entry points.
Use the runtime requirements supplied with your package version.