rudashi / fluent-regex
Elegant way for PHP regex
Requires
- php: >=8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- pestphp/pest: ^3.0
- phpstan/phpstan: ^1.0
- rector/rector: ^1.0
- symfony/var-dumper: ^7.0
README
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.
Installation
Install the package via Composer
composer require rudashi/fluent-regex
Version Guidance
Usage
$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
Documentation
The Fluent Regex documentation is extensive and complete, making getting started with regular expression syntax a breeze.
Changelog
Detailed changes for each release are documented in the CHANGELOG.md.
Credits
License
The MIT License (MIT). Please see License File for more information.