Download the PHP package mcustiel/php-simple-regex without Composer
On this page you can find all versions of the php package mcustiel/php-simple-regex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mcustiel/php-simple-regex
More information about mcustiel/php-simple-regex
Files in mcustiel/php-simple-regex
Package php-simple-regex
Short Description This is a library with a set of utils to execute and get the response from regular expressions
License GPL-3.0+
Informations about the package php-simple-regex
php-simple-regex
What is it
PhpSimpleRegex is an object oriented regular expressions library for PHP.
This library allows to execute preg* functions in PHP and use the results as objects, making the use of preg* functions testeable. PhpSimpleRegex is integrated with VerbalExpressions\PHPVerbalExpressions\VerbalExpressions, SelvinOrtiz\Utils\Flux\Flux and also MarkWilson\VerbalExpression to allow a full Object Oriented approach to Regular Expressions in PHP.
Installation
Composer:
If you want to access directly to this repo, adding this to your composer.json should be enough:
Or just download the release and include it in your path.
How to use it?
This library provides a facade class that wraps most of the preg_* functions from PHP. All you need to do is to create an instance of this class and call the methods you need.
List of methods:
- MatchResult getAllMatches(mixed $pattern, string $subject, integer $offset = 0)
- Match getOneMatch(mixed $pattern, string $subject, integer $offset = 0)
- boolean match(mixed $pattern, string $subject, integer $offset = 0)
- ReplaceResult replaceAndCount(mixed $pattern, string $replacement, mixed $subject, integer $limit = -1)
- mixed replace(mixed $pattern, string $replacement, mixed $subject, integer $limit = -1)
- mixed replaceCallback(mixed $pattern, callable $callback, mixed $subject, integer $limit = -1)
- ReplaceResult replaceCallbackAndCount(mixed $pattern, callable $callback, mixed $subject, integer $limit = -1)
- array split(mixed $pattern, string $string, integer $limit = -1, bool $returnOnlyNotEmpty = false, bool $captureOffset = false, bool $captureSubpatterns = false)
- array grep(mixed $pattern, array $input)
- array grepNotMatching(mixed $pattern, array $input)
For each method, the pattern can be a string, a Flux object, or a PhpVerbalExpression object.