The easiest way to build robust and meaningful regular expressions in PHP.
- PHP >= 8.0
RegSem can be installed with composer.
composer require bakome/regsem
Want to be part of the RegSem project? Perfect! All are welcome! Whether you find a bug, have a great feature request feel free to get in touch.
Make sure to read the Contributing Guide before submitting changes.
- Simple begin and end for expression
- Repetitions
- Special characters
use function Bakome\RegSem\{
regex,
beginsWith,
};
$regex = regex(
beginsWith('Beginning test subject')
);
// Evaluate
$regex('This is false test subject') // Returns true or false
PhpUnit run:
composer run phpunit
Psalm run:
composer run psalm
Combined run:
composer run test
Run in docker
docker run --rm -it -w "/regsem" -v "${PWD}:/regsem" php:8.2 vendor/bin/phpunit
docker run --rm -it -w "/regsem" -v "${PWD}:/regsem" php:8.2 vendor/bin/psalm
This content is released under the (http://opensource.org/licenses/MIT) MIT License.
- Followed by
- Any char
- Special chars
- Capture groups
- (Characters) classes
- https://couscous.io/templates.html Documentation