PHP code example of vincentvanwijk / fluent-regex

1. Go to this page and download the library: Download vincentvanwijk/fluent-regex library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vincentvanwijk / fluent-regex example snippets


use VincentVanWijk\FluentRegex\Facades\FluentRegex;

$fluentRegex = FluentRegex::create("foo bar baz");
regexp
/foo\s[bar baz]+/

$fluentRegex->exactly("foo")
    ->whiteSpace()
    ->anyCharacterOf('bar baz')
    ->oneOrMoreTimes();
regexp
/regex\!/

$fluentRegex->exactly("regex!")
regexp
/[a-zA-Z]/

$fluentRegex->letter();
regexp
/[^a-zA-Z]/

$fluentRegex->not->letter();
regexp
/foo (bar baz)/

$fluentRegex->exactly("foo ")      
    ->capture(function (FluentRegex $regex) {
         return $regex->exactly('bar') 
         ->whiteSpace()
         ->exactly('baz')       
    })

$fluentRegex->match();

$fluentRegex->matchAll();

$fluentRegex->get();
bash
php artisan vendor:publish --tag=":fluent-regex-config"