This package provides a simple way to create regular expression in a fluent way.
Fluent Regex is a library in PHP that simplifies the creation and management of regular expressions through the use of fluent syntax. Traditional regular expressions can be difficult to read and understand, especially when they become complex. Fluent Regex solves this problem by allowing you to build regular expressions using a readable and intuitive object-oriented interface.
If you thought that finding a
needle
in ahaystack
was impossible, this repository is for you.
- PHP 8.1+
- Composer
Install the package via Composer
composer require rudashi/fluent-regex
$regex = Rudashi\Regex::build()
->startOfLine()
->capture(fn (FluentBuilder $fluent) => $fluent->find('http')->or->find('https'))
->then('://')
->ignoreCase();
$regex->dump();
// /^(http|https)\:\/\//i
$match = Regex::for('https://100commitow.pl/')->find('100commitow')->check();
// True
The Fluent Regex documentation is extensive and complete, making getting started with regular expression syntax a breeze.
Detailed changes for each release are documented in the CHANGELOG.md.
The MIT License (MIT). Please see License File for more information.