s9e/regexp-builder
Generate compact regular expressions that match a given list of strings (ideal for keyword search). Builds optimized patterns like ba[rz]|foo from input terms, with factories for PHP, Java, JavaScript, RE2, plus RawBytes/RawUTF8 output modes.
See UPGRADING.md for backward-incompatible changes and CHANGES.md for an overview of functional changes.
See CHANGELOG.md for a list of changes.
PHP requirements have been bumped to 8.1.
⚠ Change in behaviour: alternations at the root level of the generated expression are not put in a non-capturing group anymore. This change is only relevant if the generated expression is used as part of a bigger regexp. The old behaviour can be restored at runtime via the $builder->standalone property. See below for an example.
$builder = new s9e\RegexpBuilder\Builder;
var_dump($builder->build(['foo', 'bar', 'baz']));
$builder->standalone = false;
var_dump($builder->build(['foo', 'bar', 'baz']));
string(10) "ba[rz]|foo"
string(14) "(?:ba[rz]|foo)"
This release fixes an issue (PHP error) that can occur with some combinations of strings. It requires a fairly specific combination of strings made of digits and sharing the same prefix.
All classes have been converted enforce strict typing. There is no other change.
This release fixes a typo that caused left square brackets to be incorrectly interpreted as right square brackets, as well as a typing error on PHP 7.4.
composer.json was updated.
Some internal methods have been updated with no functional change.
This release fixes an issue with unescaped carets at the beginning of a character class.
Added support for custom meta-characters. See README.md for usage.
Removed the Utf8ToSurrogates input and added a useSurrogates option to the Utf8 input class.
Added a case option to the PHP and JavaScript output classes.
See the README.md file for updated usage.
Added a new pass: CoalesceOptionalStrings. It turns (?:ab?|b)? into a?b?.
Added support for JavaScript regexps with u flag.
No functional changes from 1.0.0. Surrogates are ordered differently in JavaScript but it should have no functional effect. Some code has been simplified or refactored.
Initial release.
How can I help you explore Laravel packages today?