I am trying to create a template class which will extract certain tags in the db entries. These tags are as follows:

{table{column{key}}}

Each db entry may have one or multiple tags. Is there an easy way of get each tag into an array like:

Array([0]=>Array("Table" => {table}, "Column" => {column}, "Key" => {key}), [1]=>Array(...

I have gotten a snippet that can put the contents of 2 curly braces into the preg_match_all:

$regex = '/\{(.+?)(?:\{(.+)\})?\}/';

But I need three and a way to tidy the matches array.

Any help would be gratefully received!