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:

Code:
$theTemplate = eregi_replace('{[^ }]*}', '', $theTemplate);
Code:
$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).

Thanks!