Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created January 2, 2019 08:41
Show Gist options
  • Save jskeet/8879cf9aee5177baad8d235341027331 to your computer and use it in GitHub Desktop.
Save jskeet/8879cf9aee5177baad8d235341027331 to your computer and use it in GitHub Desktop.
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string text = @"A Foobar is cool stuff, as we can see in Figure 1.1:
Figure 1.1 This is a Foobar";
text = Regex.Replace(text, "^ +(Figure.*)$", "##### _$1_", RegexOptions.Multiline);
Console.WriteLine($"'{text}'");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment