尝试使用以下正则表达式时遇到问题:
string profileConfig = File.ReadAllText(str);
string startIndex = "user_pref(\"network.proxy.autoconfig_url\", \"";
string endIndex = "\"";
var regex = startIndex + "(.*)" + endIndex;
// Here we call Regex.Match.
Match match = Regex.Match(profileConfig,
regex,
RegexOptions.IgnoreCase);
// Here we check the Match instance.
if (match.Success)
{
// Finally, we get the Group value and display it.
string key = match.Groups[1].Value;
MessageBox.Show(key);
}
我得到错误:
附加信息:解析“user_pref("network.proxy.autoconfig_url", "(.*)"" - 还不够)。
我的正则表达式是否以某种方式格式错误?