using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d{4})_(\d{2})_(\d{2})_(.*).md";
string substitution = @"$1/$2/$4/index.md";
string input = @"2005_03_19_this_is_the_filename.md
2007_07_23_another_filename.md
2021_01_12_filename.md";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx