PHP:preg_match帮助[关闭]

I'm very new to regular expressions, can you tell me the preg_match solution for string printed below?

{foreach $gobar}
Anything here
{/foreach}

Thanks.

if (preg_match('#\{foreach \$gobar\}
(.*)
\{\/foreach\}#', $yourData, $matches)) {
    echo $matches[1]; // "Anything here"
}