using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"href=([""|\']\/?[""|\'])";
string input = @"<li><a href=""http://www.userlink1.com/my/page.html"" custattr=""value1""><img alt=""Userlink"" class=""common_link_class"" height=""123"" src=""pic0.png"" width=""123"" style=""width: 123px;""></a></li><li><a href=""//www.socnet1.com/username1.css"" custattr=""value1""><img alt=""Socnet1"" class=""common_link_class"" height=""123"" src=""pic1.png"" width=""123"" style=""width: 123px;""></a></li><li><a href=""//www.socnet2.com/username1.js"" custattr=""value1""><img alt=""Socnet2"" class=""common_link_class"" height=""123"" src=""pic2.png"" width=""123"" style=""width: 123px;""></a></li><li><a href=""mailto:useralias1@unlikely.zyx321.usermail.net"" custattr=""value1""><img alt=""Usermail"" class=""common_link_class"" height=""123"" src=""pic3.png"" width=""123"" style=""width: 123px;""></a></li><li><a href=""/www.userlink2.com/my/page.php?id=2&ok=1"" custattr=""value1""><img alt=""Userlink"" class=""common_link_class"" height=""123"" src=""pic4.png"" width=""123"" style=""width: 123px;""></a></li>
";
RegexOptions options = RegexOptions.IgnoreCase;
Match m = Regex.Match(input, pattern, options);
Console.WriteLine("'{0}' found at index {1}", m.Value, m.Index);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx