IComeFromTheNet.

Reverse Regex

A project with a simple goal, convert a regular expression into a text string. Other platforms have access to same functionality it's been implemented in Java, .Net , perl , ruby.

I developed this as part of Faker but decided that others might have use of it and spun it out an example will help illustrate.

    <?php
    use ReverseRegex\Lexer;
    use PHPStats\Generator\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;
    ?>