You can install the package via composer:
composer require mpociot/human-regex
$regex = HumanRegex::create()
->alphanumerics()
->then('-')
->digits()->exactly(4)
->then('-')
->digits()->exactly(2)
->then('-')
->digits()->exactly(2)
->then('.')
->thenEither('mov')->or('mp4');
$regex->matches('foobar-2016-08-29.mp4');
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email m.pociot@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.