rudashi/fluent-regex

Elegant way for PHP regex

2.0.0 2024-11-03 07:53 UTC

This package is auto-updated.

Last update: 2024-12-07 09:03:51 UTC


README

Codacy Badge codecov GitHub Actions Workflow Status GitHub last commit
GitHub repo size Total Downloads GitHub License

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 a haystack 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.