i had to do this this way but thanks SadBunny that helps a lot your post several of my problems are solved because of that site. string pattern = @"(""[^\]+\)(?:[^\""]+\)*([^""]+"")";
string data = regedit.exe /e:a "D:\data\backup\laptop\CCleaner\CCleaner.reg" "HKEY_CURRENT_USER\Software\Piriform\CCleaner"
string replacement = "$1...\$2";
Regex rgx = new Regex(pattern);
data = rgx.Replace("\"" + data + "\"", replacement);
data = data.TrimStart('"');
data = data.TrimEnd('"');