关于正则表达式的问题
我想通过正则表达式解析HTML标签,包括取得标记名称、属性和内容,可是如下的正则表达式却取不到属性,也就是说属性是空的,请高手赐教:
Regex extractHTMLRegex = new Regex("<(?<outertag>[a-z]+[\\d]?)(?<attributes>[^>]*)*>"+
"(?<innerhtml>(<(?<innertag>[a-z]+[\\d]?)[^>]*>.*?</\\k<innertag>>|"+
"<[a-z]+[\\d]?[^>]*>|(?>[^<]*))*(?=</\\k<outertag>>))?",
RegexOptions.IgnoreCase |
RegexOptions.Compiled |
RegexOptions.ExplicitCapture |
RegexOptions.Singleline);
---------------------------------------------------
String sTag = matchMade.Groups[1].Value; //标记可正确获取
String sAttribute = matchMade.Groups[2].Value; //属性为空,什么都不输出????????????