RegEx is designed around matching patterns on single lines. You can hack it to work on multiple lines but like steveo says it's probably the not the solution for this problem. You need write a multi line processor separating the headers (noted by the blank
line), capture all of the encoded text looking for a line containing the marker, i.e. IndexOf('---marker----') <> -1, capture the beginning of that line up until the marker and you're done.