in reply to Matching a pattern in Regex
s{<figr n="([^"]+)">(.*?)</figr>} {'<FIGIND NUM="'.$1.'" ID="FG.'.sprintf("%03d", $1).'">'.$2.'</FIGIND> +'}eg; [download]