当前位置:编程学习 > C#/ASP.NET >>

正则表达式,请教高手

我想写一个匹配html代码中的<table > </table>标签,以及获取<table>的属性的正则表达式,我写了一个,
<table[^>]*>[^<>]*(((?'Open'<table[^>]*>)[^<>]*)+((?'-Open'</table>)[^<>]*)+)*(?(Open)(?!))</table>
却不成功,请教大家!!! --------------------编程问答-------------------- <table[^> ]*> [^ <> ]*?(?:(?:(?'Open' <table[^> ]*> )[^ <> ]*?)+((?'-Open' </table> )[^ <> ]*)+)*?(?(Open)(?!)) </table> --------------------编程问答-------------------- 最好能写个例子,不然不知道你想实现什么。 --------------------编程问答-------------------- 我想在给定得html代码中,

<body>
    <div id="wrapper">
        <div id="CSDNPHL">
            <table class="CSDN-PHF" border="0" cellspacing="1" cellpadding="0">
                <tr>
                    
                </tr>
            </table>
        </div>

    <div id="mainWrapper">
   
                        <table border="0" cellpadding="0" cellspacing="1">
                            <tr>
                                <td colspan="2" class="pageCaption">
                                    欢迎 <dfn>
                                        chinesesunmt
                                        ()</dfn> 来CSDN发表新话题</td>
                            </tr>
                            
                            <tr>
                                <td class="left">
                                    相关问题:</td>
                                <td>
                                    <dl id="relationTopic">
                                        <dt>输入问题,问题答案立即呈现在您眼前!</dt>
                                        <dd id="relationList">
                                        </dd>
                                    </dl>
                                </td>
                            </tr>
                            
                            </tr>
                        </table>
</body>
我想匹配其中<table>  </table>中得属性:例如得到class="CSDN-PHF" border="0" cellspacing="1" cellpadding="0",但是我写得正则表达式不正确,求救,谢谢! --------------------编程问答-------------------- 正则表达式不是万能的,很多方法可以实现你的要求的。
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,