This code prints "Got match" if the string can be matched in the /$reg/. Is is possible for me not just to match but display all the possible strings from that regular expression. Like for example my regular expression is "(a|b)\*" possible strings are aaaa, abbb, bbbb, bbbaa, etc. I want to print all of those with the maximum length 5.

```
if(isset($_POST['calc'])){
$reg = $_POST['regex']; 
$str = $_POST['str'];

if (preg_match("/$reg/", $str)) 
{
    echo "Got match!";
}

else 
{
echo "String not valid";
}
}

?>

```