2017-06-02 40 views
0

我有一个大文件引用其中的一个URL。它始终格式:C#中的通配符字符串替换

URL="........." - where the ellipses are the URL. 

我有一个新的URL想,以取代以前的,我想知道是否有任何形式的通配符字符串替换的。

Example: 
A large string contains: URL="google.com" 

Problem: 
I need to replace the above with: URL="123.com" 

感谢所有帮助

+1

[与string.replace](https://msdn.microsoft.com/en-us/library/fk49wtc1 (v = vs.110).aspx) – adv12

回答

1
Regex.Replace(line, @"URL\s*=\s*"".+?""", @"URL=""123.com"""); 
+0

这也对,但有人打你。谢谢!! – siegs