using System;
using System.Text .RegularExpressions ;
public class Test
{
public static void Main( )
{
string msg= "xxSTART Here we have the first text in 1234 asdf xxENDxxSTART Here we have the second text 999 fffd xxENDxxSTART Here we have the third text 1234 9985Df xxENDxxSTART Here we have the fourth text 1234 asdf Dert xxEND" ;
var reg = new Regex( @"^(?:xxSTART.*?){3}\s*(.*?)xxEND" ) ;
var match = reg.Match ( msg) ;
string matched = match.Groups [ 1 ] .Value ;
Console.WriteLine ( matched) ;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CnB1YmxpYyBjbGFzcyBUZXN0CnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgIHsgICAKICAgICAgICBzdHJpbmcgbXNnPSAieHhTVEFSVCBIZXJlIHdlIGhhdmUgdGhlIGZpcnN0IHRleHQgaW4gMTIzNCBhc2RmIHh4RU5EeHhTVEFSVCBIZXJlIHdlIGhhdmUgdGhlIHNlY29uZCB0ZXh0IDk5OSBmZmZkIHh4RU5EeHhTVEFSVCBIZXJlIHdlIGhhdmUgdGhlIHRoaXJkIHRleHQgMTIzNCA5OTg1RGYgeHhFTkR4eFNUQVJUIEhlcmUgd2UgaGF2ZSB0aGUgZm91cnRoIHRleHQgMTIzNCBhc2RmIERlcnQgeHhFTkQiOwogICAgICAgIHZhciByZWcgPSBuZXcgUmVnZXgoQCJeKD86eHhTVEFSVC4qPyl7M31ccyooLio/KXh4RU5EIik7CiAgICAgICAgdmFyIG1hdGNoID0gcmVnLk1hdGNoKG1zZyk7CiAgICAgICAgc3RyaW5nIG1hdGNoZWQgPSBtYXRjaC5Hcm91cHNbMV0uVmFsdWU7CiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUobWF0Y2hlZCk7CiAgICB9Cn0=