php regex - can't find the error
- by peirix
Just one simple, specific question:
I've got the string {var1}12345{var2}, and I want to get the variable names used.
if (preg_match("/{([a-zA-Z0-9]*)}/g", $url, $matches)) {
print_r($matches);
}
If I remove the global flag, it works, but I only get the first variable, as expected. Why isn't it working with a global flag? It works when I'm testing it with the Regex Tester