I have an archive of PCL files. I would like to make a console app that would read a file, strip out all print control codes, and write the codes to a separate file, leaving the rest of the document in tack. I think I can do this with a regex(), but I'm not sure how to approach the task. My language of choice is C#. Any advice you can provide will be greatly appreciated.
I've made progress with
public static string RemoveBetween(string s, char begin, char end)
{
Regex regex = new Regex(string.Format("\\{0}.*?{1}", begin, end));
return regex.Replace(s, string.Empty);
}
public static string[] getPclCodes(string line)
{
string pattern = "\\x1B.*?H";
string[] pclCodes = Regex.Split(line, pattern);
return pclCodes;
}
but the codes return as empty strings. I can strip them out of the PCL and write a txt file, but I need the codes also. I call getPclCodes before RemoveBetween. Any ideas?