I have a variable with a small text like:
$s = "bla bla bla {name} bla bla bla bla bla bla {city} bla bla bla {address}";
I need to use a regular expression to get ALL the name inside { }
In this case I need an array as result with:
How to use preg_match
to get all the texts inside the brackets ?
Thanks
This works for me:
$s = "bla bla bla {name} bla bla bla bla bla bla {city} bla bla bla {address}";
preg_match_all("/\{([^\}]+)\}/i", $s, $matches);
$results = $matches[1];