In PHP, I used the ereg() function to determine whether a specified string can possibly generated by an input regular expression. I want to display all the strings that could be possibly generated by the regular expression given. How could I do that?
This is my current code that prints the string if it can be generated by regular expression $reg. I want to make it more complex by displaying all possible strings that could be generated by the regex.
<?php
$reg = $_POST['regex'];
if(isset($_POST['calc'])){
if (ereg ("$reg", "kkjjj", $st))
{
for($i = 0; $i < count($st)-1; $i++)
{
echo "$st[$i]";
}
}
else
{
echo "String not valid";
}
}
?>