我有以下字符串:aWesdE,我想转换为http://myserver.com/aWesdE.jpg使用Regex.Replace(string, string, string, RegexOptions)
目前,我使用此代码:
string input = "aWesdE";
string match = "(.*)";
string replacement = "http://myserver.com/$1.jpg";
string output = Regex.Replace(input, match, replacement,
RegexOptions.IgnoreCase | RegexOptions.Singleline);
Run Code Online (Sandbox Code Playgroud)
结果是输出结果如下: http://myserver.com/aWesdE.jpghttp://myserver.com/.jpg
因此,替换值正确显示,然后似乎再次附加 - 非常奇怪.这里发生了什么?