using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
string text = "A Foobar is cool stuff, as we can see in Figure 1.1:\r\n\r\n Figure 1.1 This is a Foobar\r\n\r\nMore text here.";
text = Regex.Replace(text, "^ +(Figure[^\r\n]*)", "##### _$1_", RegexOptions.Multiline);
Console.WriteLine(text);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkJc3RyaW5nIHRleHQgPSAiQSBGb29iYXIgaXMgY29vbCBzdHVmZiwgYXMgd2UgY2FuIHNlZSBpbiBGaWd1cmUgMS4xOlxyXG5cclxuICBGaWd1cmUgMS4xICBUaGlzIGlzIGEgRm9vYmFyXHJcblxyXG5Nb3JlIHRleHQgaGVyZS4iOwogICAgICAgIHRleHQgPSBSZWdleC5SZXBsYWNlKHRleHQsICJeICsoRmlndXJlW15cclxuXSopIiwgIiMjIyMjIF8kMV8iLCBSZWdleE9wdGlvbnMuTXVsdGlsaW5lKTsKICAgICAgICBDb25zb2xlLldyaXRlTGluZSh0ZXh0KTsKCX0KfQ==