I have a list of regular expressions like
$regex = "{Hello ([a-zA-Z]+), you are ([0-9]{2}) years old today\.}u"
Is there a function to do something like the following :
$result = function_i_am_looking($regex, "John", 25);
echo $result; // Outputs : "Hello John, you are 25 years old today."
Note: this is not some kind of templating engine I'm building ;)
Note 2: I can't predict what regex will be and in what order.
$regexisn't valid PRCE Regex though.sprintffor writing strings from a format, but that's not the same thing as a regex{}are allowed for regex in PHP (in fact, any non alphanumerical characters ;)