using System.Text.RegularExpressions;
public static void Main()
var text = @"Replace(FileName, "".txt"", "".doc"")";
Console.WriteLine("FileNmae: {0}", c.FileNmae);
Console.WriteLine("Doc: {0}", c.Doc);
Console.WriteLine("Txt: {0}", c.Txt);
public string FileNmae { get; set; }
public string Doc { get; set; }
public string Txt { get; set; }
private static string pattern = @"
private Regex regex = new Regex(pattern,
| RegexOptions.ExplicitCapture
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
public void Parse(string text)
Console.WriteLine("text: {0}",text);
Match m = regex.Match(text);
FileNmae = m.Groups["filename"].ToString();
Doc = m.Groups["doc"].ToString();
Txt = m.Groups["txt"].ToString();