<!DOCTYPE html>
<html>
<head>
</head>
<img alt="Mountain View" src="Tab1.png" style="width:304px;height:228px;">
<img src="Tab2.png" alt="Mountain View" style="width:304px;height:228px;">
<img alt="Mountain View" src="Tab3.png" style="width:304px;height:228px;">
<img src="Tab4.png" alt="Mountain View" style="width:304px;height:228px;">
<a href="https://www.w3schools.com">Visit W3Schools</a>
</body>
</html>
答案 0 :(得分:1)
如果您逐行阅读文件,这里有一个如何使用正则表达式替换源的示例:
string test = "<img alt=\"Mountain View\" src=\"Tab1.png\" style=\"width:304px;height:228px;\">";
string mySource = "src=\"Weird.png\" ";
string newtest = Regex.Replace(test, "src=\".+\"\\s",mySource);
我仍然建议按照我在评论中链接的答案