我想替换像
这样的字符串Dependencies\myfolder\1\2\abc.dll
Dependencies\myfolder\abc.dll
Dependencies\myfolder\1\abc.dll
带
packages\abc.dll.
执行此操作的合适正则表达式模式是什么。我期待这个模式是 -
Dependencies*abc.dll
所以我的代码是 -
var newEntry = packages\abc.dll;
var pattern = Dependencies*abc.dll;
var allText = ""; //this contains the text read from a file
Regex rgx = new Regex(pattern);
rgx.Replace(allText, newEntry);
但这似乎是一种错误的正则表达式模式。