Chevere Regex 1.0

Validated regular expression

rodber   GitHub

New from Chevere is the Regex package. This software enables to work with validated regular expression.

The package source is available at chevere/regex.

The Regex package enables to create a Regex object from a regular expression with valid syntax check:

use Chevere\Regex\Regex;

$regex = new Regex('/^Hello World!$/');

From there it provides handy methods to read the original regular expression:

// /^Hello World!$/

// ^Hello World!$

// Hello World!

It provides methods returning array for value matching:

$match = $regex->match($value);
$matches = $regex->matchAll($value);

And it provides assertion matching which throws an exception on no matches:

Rodolfo blogging since 2012.