I agree with that opinion, that regular expressions should be the last resort. If you think , you can't do without them anyway, then try the following:
string pattern = @"(?<="".+),\s(?=.+"")";
string replacment = @" - ";
string modLine = "";
foreach (var item in tmp.Split(new string[] {Environment.NewLine}, StringSplitOptions.None)) {
MatchCollection matches = Regex.Matches(item, pattern);
if (matches.Count > 0) {
foreach (var match in matches) {
modLine = Regex.Replace(item, match.ToString(), replacment);
}
}
Console.WriteLine(modLine );
}
wizend
This simply wipes out the entire output file. The result is a blank file.
Thanks for the input.
No comments:
Post a Comment