- preg_replace_callback: documentation ( source)
- print_r: documentation ( source)
<?php
$line="This is the first test.{@font-face:Garamond}";
$line=preg_replace_callback("/(?<![\]\\])\{([\w\s\\@:=\'\"-\.;^}]*)(?<!\\)\}/",function ($match){print_r($match);return 'foo';},$line);
echo $line;