Project Logo


Programmer-oriented Regular Expressions library for PHP

  • Lightweight
  • Reliable
  • Easy to use
  • Based on exceptions


Automatic delimiters

You no longer need to delimiter your patterns. T-Regx' smart delimiterer will add one of many delimiters for you, if they're not already present.
Build StatusCoverage StatusDependenciesRepository SizeLicenseGitHub last commitGitHub commit activity"
PHP VersionPHP VersionPHP VersionPHP VersionPHP VersionPHP Version


composer require rawr/t-regx

Match details

With pattern()->match() and pattern()->replace(), it's trivial to retrieve, iterate, map and filter matches with callbacks and a detailed Match object.

Written with clean design in mind

No Reflection used, No (...varargs), No (boolean arguments, true), (No flags, 1)

Based on exceptions!

If any error occurs while using regexp (invalid pattern, malformed UTF8, backtrack limit, nonexistent group, anything!) T-Regx throws an exception.

SafeRegex | Converts warnings to exceptions

SafeRegex watches for warnings, analyzes preg_() methods return values and looks up preg_last_error() to validate a call. If it fails, an exception is thrown.

Functional programming

T-Regx utilizes chainable, functional programming with methods like filter(), map(), flatMap(), first()/forFirst(), etc.