Example #1
0
 /**
  * @param string $regex
  *
  * @return string
  * @throws InvalidRegexException
  */
 public function generate($regex)
 {
     $expr = substr($regex, 1, -1);
     try {
         $result = RegRev::generate($expr);
     } catch (\Exception $e) {
         throw new InvalidRegexException($expr);
     }
     return $result;
 }
Example #2
0
 /**
  * @param string $regex
  *
  * @return string
  * @throws InvalidRegexException
  */
 public function generate($regex)
 {
     $expr = substr($regex, 1, -1);
     $result = RegRev::generate($expr);
     if ($result !== null) {
         return $result;
     } else {
         throw new InvalidRegexException($expr);
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function generate()
 {
     return RegRev::generate(substr($this->getMatch(), 1, -1));
 }
Example #4
0
<?php

require 'vendor/autoload.php';
use RegRev\RegRev;
echo RegRev::generate($argv[1]);
//ouput a random number
echo "\n";