in reply to Problem with Regex

I've found range operators pretty helpful when looking for text between XML tags. A variation on something like this might work:
perl -e '$tag = "text"; while(<>) {print if(/<$tag/ .. m!</$tag!)}' fi +le.txt
Output:
<text xml:space="preserve">some Text ... ......... ..................... ..................... .....................</text>