Possible Duplicate:
regex help with getting tag content in PHP
At first, please no comment about parsing html with regex. I know that it is not possible but it should do its job in this case.
I try to get the content of <country lan="x">...</country>
tags. There is no special case like <country />
and the PHP DOM Parser fails due to the content of the tags which contains many special chars (MediaWiki text).
So I have some text like
<country lan="en">
dsadasd
{|,'''""" }}|]][][]//\\\\\2r2erfaf<>><<<#<div> --..,;;"!"§$%&/()=?`´´``***+~~~''
0131ß
ÄÜÖ#ax
</country>
My solution at the moment is $pattern = <country lan=\"en\">(.|\t|\r|\n|\s)*<\/country>
which seems to match using
preg_match_all($pattern, $content, $matches);
print_r($matches);
but the printed result is just an empty array. How can I extract only the string between the <country lan="x">...</country>
tags?