PHPRegex Documentation

You are browsing the source folder. The served documentation lives at php-regex.com — full-text search, a dark mode, and links that survive file renames.

PHPRegex parses a PCRE pattern into an AST and gives structured answers about validity, meaning, backtracking risk, capture shape, and equivalence. The documentation is organized by what you are trying to do.

Choose your path

Deeper in, the same paths continue:

Read findings correctly

PHPRegex separates three kinds of answers:

Proven
Follows from the parsed pattern itself, from a mathematical model built on it, or from running the pattern on the real PCRE engine.
Heuristic
The pattern uses a construct outside the proof model, or the analysis hit its budget, so conservative structural rules decided.
Unknown
Records that the analysis refuses to guess.

The correctness contracts define those boundaries feature by feature. Treat a ReDoS finding as a strong lead to investigate, not a substitute for reviewing the rewrite.

Documentation map

  • Learn: tutorial, PHP regex guide, ReDoS guide, cookbook, troubleshooting.
  • Integrations: CLI, PHPStan, Psalm, Rector, PHPUnit, Laravel, Symfony, language server.
  • Concepts: AST, visitors, PCRE behavior, and ReDoS theory.
  • Reference: diagnostics, API, output contracts, support matrices, compatibility.
  • Internals: architecture, traversal, AST nodes, visitors, extending, adding a lint rule, maintainer guide.

Getting help

Edit on GitHub Feedback