fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. 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.";
  9. text = Regex.Replace(text, "^ +(Figure[^\r\n]*)", "##### _$1_", RegexOptions.Multiline);
  10. Console.WriteLine(text);
  11. }
  12. }
Success #stdin #stdout 0.03s 134592KB
stdin
Standard input is empty
stdout
A Foobar is cool stuff, as we can see in Figure 1.1:

##### _Figure 1.1  This is a Foobar_

More text here.