public struct Strep
{
public string Patstr { get; set; }
public string Repstr { get; set; }
}
public static string GetMTextRegstr(string input)
{
string tXTstr = input;
List<Strep> replst = new List<Strep>()
{
new Strep(){Patstr= @"\\\\" ,Repstr=((char)1).ToString()},
new Strep(){Patstr= @"\\{" , Repstr=((char)2).ToString()},
new Strep(){Patstr= @"\\}" , Repstr=((char)3).ToString()},
new Strep(){Patstr= @"\\pi(.[^;]*);" , Repstr=""},
new Strep(){Patstr= @"\\pt(.[^;]*);" , Repstr=""},
new Strep(){Patstr= @"\\S(.[^;]*)(^|#|\\)(.[^;]*);" , Repstr=""},
new Strep(){Patstr= @"(\\F|\\f|\\C|\\H|\\T|\\Q|\\W|\\A)(.[^;]*);" , Repstr=""},
new Strep(){Patstr= @"(\\L|\\O|\\K|\\l|\\o)" , Repstr=""},
new Strep(){Patstr= @"\\~" , Repstr=""},
new Strep(){Patstr= @"\\pse1;" , Repstr=""},
new Strep(){Patstr= @"\\pql;" , Repstr=""},
new Strep(){Patstr= @"\\pqc;" , Repstr=""},
new Strep(){Patstr= @"\\pqr;" , Repstr=""},
new Strep(){Patstr= @"\\pxqc;" , Repstr=""},
new Strep(){Patstr= @"({|})" , Repstr=""},
new Strep(){Patstr= @"\x01" , Repstr=@"\\\\"},
new Strep(){Patstr= @"\x02" , Repstr="{"},
new Strep(){Patstr= @"\x03" , Repstr="}"}
};
foreach (Strep sr in replst)
{
tXTstr = Regex.Replace(tXTstr, sr.Patstr, sr.Repstr);
}
return tXTstr;
}