string val = reg.Match(test1).Groups["content"].Value;
------解决方案-------------------- ^\"\w*\"|\'\w*\'|\w*$
测试一下
------解决方案-------------------- 这样就可以了
string rex = "\"+|'+"; Console.Write(regex.Replace(str, ""));
------解决方案-------------------- string rex = "\"+ ¦'+"; Regex regex = new Regex(rex); Console.Write(regex.Replace(str, ""));
把引号和分号全都换成空字符串
------解决方案-------------------- var str="Attribute=id" var aa=new RegExp("^Attribute=(.*)$"); var ss=str.match(aa)
------解决方案--------------------
string[] test = new string[] { "attributeName=\"*\"", "attributename='*'", "attributename=*" };
foreach (string s in test)
{
Match m = Regex.Match(s, @"attributeName=([""']?)(?<name>[^""'\s]*)\1", RegexOptions.IgnoreCase);
if (m.Success)
richTextBox1.Text += m.Groups["name"].Value + "\n";
}