日期:2014-05-20  浏览次数:20645 次

抢分咯!简单正则表达式问题(已有部分代码)!
我要从aspx文件中提取所有的服务器控件(包括控件的ID、类型、Name属性(存在的情况下),如果是input类型的控件,还要提取type属性的值)

现在已经实现了提取服务器控件的Id、类型的提取,代码如下:

源文件字符串:
<%@   Page   Language= "VB "   AutoEventWireup= "false "   CodeFile= "Default.aspx.vb "   Inherits= "_Default "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                &nbsp;
                <input   id= "Checkbox1 "   style= "z-index:   103;   left:   64px;   position:   absolute;   top:   16px "
                        type= "checkbox "   runat= "server "   />
                <asp:TextBox   ID= "TextBox1 "   runat= "server "   Style= "z-index:   100;   left:   240px;   position:   absolute;
                        top:   112px "> </asp:TextBox>
                <asp:Label   ID= "Label1 "   runat= "server "   Style= "z-index:   101;   left:   128px;   position:   absolute;
                        top:   224px "   Text= "Label "> </asp:Label>
                <asp:ListBox   ID= "ListBox1 "   runat= "server "   Style= "z-index:   102;   left:   392px;   position:   absolute;
                        top:   72px "> </asp:ListBox>
       
        </div>
        </form>
</body>
</html>

正则表达式:
"\ <(? <TypeName> [a-zA-Z:]+)\s*(ID|id)=\ " "(? <IDName> \w+)\ " "\s*[^\> ]+runat=\ " "server\ " "[[^\> ]|[\s*]]+\> "

请帮我把提取控件名称的正则表达式(Name|name)=\ " "(? <ControlName> \w+)\ " "和提取类型的正则表达式(Type|type)=\ " "(? <Type> \w+)\ " "添加到上面正则表达式的合理位置中!

在线等答案!有了答案就结贴给分!呵呵!谢谢!




------解决方案--------------------
关注一下,希望高手来解决一下
------解决方案--------------------
学习..
------解决方案--------------------
学习ing....希望高手来解决一下

------解决方案--------------------
UP
------解决方案--------------------
id跟控件名称,控件类型有啥区别?
------解决方案--------------------