I have always had trouble reading and understanding the details that one can place into a eregi_replace function...for example, can anyone please explain to me what the following do:

$theTemplate = eregi_replace('{[^ }]*}', '', $theTemplate);
$theTemplate = eregi_replace('{([^ }]*)}', '<!-- \\1 undefined -->',$theTemplate);
Specially, what the parts in the squiggly brackets do?
I know what the function does in general (replace pattern match with new string in the string that you mention).