icomefromthenet/reverse-regex
Generate sample strings from regular expressions for test data and validation. ReverseRegex parses a supported subset of regex syntax (literals, groups, character classes, quantifiers, escapes, some Unicode via \X{####}) and outputs randomized matching text via PHP generators.
Use Regular Expressions to generate text strings can be used in the following situations:
##Example
use ReverseRegex\Lexer;
use ReverseRegex\Random\SimpleRandom;
use ReverseRegex\Parser;
use ReverseRegex\Generator\Scope;
# load composer
require "vendor/autoload.php";
$lexer = new Lexer('[a-z]{10}');
$gen = new SimpleRandom(10007);
$result = '';
$parser = new Parser($lexer,new Scope(),new Scope());
$parser->parse()->getResult()->generate($result,$gen);
echo $result;
Produces
jmceohykoa
aclohnotga
jqegzuklcv
ixdbpbgpkl
kcyrxqqfyw
jcxsjrtrqb
kvaczmawlz
itwrowxfxh
auinmymonl
dujyzuhoag
vaygybwkfm
##Installing
To install use composer
{
"require" : {
"icomefromthenet/reverse-regex" : "dev-master"
}
}
\X{####} to specify unicode value use [\X{####}-\X{####}] to specify range.\p not supported, I could not find a port of UCD to php, maybe in the future support be added.+ and * quantifers they apply a possible maxium number of occurances up to PHP_INT_MAX.How can I help you explore Laravel packages today?