oldvalue = "RGB = (255,000,255,000)"
newvalue = "RGB = (255,255,000,000)"
File.WriteAllText("C:\\Users\\devdrone\\Desktop\\Abc.txt",
Regex.Replace(File.ReadAllText("C:\\Users\\devdrone\\Desktop\\Abc.txt"),
oldvalue,
newvalue));
這並非取代新值。如何用正則表達式替換包含圓括號(括號)的文本?
但它與
oldvalue = "RGB 1"
newvalue = "RGB 0"
你肯定也有_exact_比賽'RGB =''中Abc.txt'(255000255000)? –
正則表達式中的括號有特殊含義,所以會混淆 – BugFinder
@Anton yes ABC.txt中有一個完全匹配的RGB =(255,000,255,000) –