Reputation: 8582
I have the following issues:
So far I generate random strings then match them against the pattern. This works, but may take a pretty long time for more complex patterns.
Are there any other ways to do this?
Upvotes: 0
Views: 896
Reputation: 2352
have a look at the Reverse Parser:
https://github.com/icomefromthenet/ReverseRegex
$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 this output:
jmceohykoa
aclohnotga
jqegzuklcv
ixdbpbgpkl
...
Upvotes: 1