PHP Regular expressions made easy
You need them before installing the package.
- You need PHP 7.2.5 or above
- You composer 2.3 or above
composer require azibom/easy-regex
<?php
require 'vendor/autoload.php';
use Azibom\EasyRegex\Builder;
$builder = new Builder();
$builder
->start()
->see("http")
->maybeSee("s")
->see("://")
->something()
->see(".")
->something()
->end();
echo $builder->getRegex() . PHP_EOL;
if ($builder->match("https://google.com")) {
echo "Match found!" . PHP_EOL;
} else {
echo "No match." . PHP_EOL;
}
// /^(http)(s)?(\:\/\/)(?:.+)(\.)(?:.+)$/
// Match found!
The goal of this project is to make a complete regex helper library for the PHP language.
Any contribution in the form of an issue or a pull request is more than welcome! Also if you have any questions, feel free to create a new issue or comment on existing ones.