- A+
所属分类:c#
static void Main(string[] args)
{
Regex reg = new Regex(@"url\((['""]?)(.+[^'""])\1\)"); //注意里面的引号 要用双引号表示,而不是用反斜杠
Console.WriteLine(reg.Match(@"{background-image:url(//ssl.gstatic.com/ui/v1/menu/checkmark.png);backgro")); //输出 url(//ssl.gstatic.com/ui/v1/menu/checkmark.png)
Console.ReadKey();
}static void Main(string[] args)
{
Regex reg = new Regex(@"\b(?<group>\w+ +)\k<group>");
string str = "what the hell are you you talking about?";
Console.WriteLine(reg.Match(str));
Console.ReadKey();
}