Heim  >  Artikel  >  Backend-Entwicklung  >  这个正则如何匹配

这个正则如何匹配

WBOY
WBOYOriginal
2016-06-13 13:44:261059Durchsuche

这个正则怎么匹配?
其中“联系人”和“联系人1”为联系人姓名,“hddf@dd.com”和“sdfdf@ss.com”为联系人邮箱,怎么讲他们匹配出来?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
    
联系人 hddf@dd.com [写信] [列出来信] [编辑]
<script>Num++</script>
联系人 sdfdf@ss.com [写信] [列出来信] [编辑]
<script>Num++</script>


------解决方案--------------------
PHP code


$match = '/<td><a>]*?)>([^]*?)>([^
        <tbody>
<tr>
            <td class="Addr_Td_Checkbox"><input type="checkbox" name="chk-_0_0_" value="hddf%40dd.com"></td>
<td class="Addr_Td_Name"><a href="ldvcapp?funcid=prtsearchres&sid=FAGuWpCkWFJAmgYZ&iid=0&mode=1&emptymode=1&print.x=1&tempname=address/add.htm">联系人</a></td>
<td class="Addr_Td_Address"><a href="ldvcapp?funcid=prtsearchres&sid=FAGuWpCkWFJAmgYZ&iid=0&mode=1&emptymode=1&print.x=1&tempname=address/add.htm">hddf@dd.com</a></td>
<td class="Addr_Td_Opt">[<a href="/coremail/fcg/ldmmapp?sid=FAGuWpCkWFJAmgYZ&funcid=compose&to=%22%B5%C4%B7%A2%C9%FA%B5%D8%22%20%3Chddf%40dd.com%3E" target="_parent">写信</a>] [<a href="ldsrchapp?funcid=srchhand&sid=FAGuWpCkWFJAmgYZ&word=hddf%40dd.com&fromonly=yes&fid=0&subfolder=yes&perfectmatch=1&rtnurl=" target="_parent">列出来信</a>] [<a href="ldvcapp?funcid=loadiadd&iid=0&sid=FAGuWpCkWFJAmgYZ&ifirstv=&lid=&modify.x=1">编辑</a>]</td>

        </tr>
        </tbody>
<tbody>
    

<script>Num++</script>







<!--   2-->

    <table class="Addr_setTable Addr_setTable_Con">

        <tbody>
<tr>
            <td class="Addr_Td_Checkbox"><input type="checkbox" name="chk-_0_1_" value="sdfdf%40ss.com"></td>
<td class="Addr_Td_Name"><a href="ldvcapp?funcid=prtsearchres&sid=FAGuWpCkWFJAmgYZ&iid=1&mode=1&emptymode=1&print.x=1&tempname=address/add.htm">联系人</a></td>
<td class="Addr_Td_Address"><a href="ldvcapp?funcid=prtsearchres&sid=FAGuWpCkWFJAmgYZ&iid=1&mode=1&emptymode=1&print.x=1&tempname=address/add.htm">sdfdf@ss.com</a></td>
<td class="Addr_Td_Opt">[<a href="/coremail/fcg/ldmmapp?sid=FAGuWpCkWFJAmgYZ&funcid=compose&to=%22sfsdd%22%20%3Csdfdf%40ss.com%3E" target="_parent">写信</a>] [<a href="ldsrchapp?funcid=srchhand&sid=FAGuWpCkWFJAmgYZ&word=sdfdf%40ss.com&fromonly=yes&fid=0&subfolder=yes&perfectmatch=1&rtnurl=" target="_parent">列出来信</a>] [<a href="ldvcapp?funcid=loadiadd&iid=1&sid=FAGuWpCkWFJAmgYZ&ifirstv=&lid=&modify.x=1">编辑</a>]</td>
        </tr>
        </tbody>
<tbody>
    </tbody>
</table>

<script>Num++</script>

begin;


preg_match_all($match,$str,$arr);
var_dump($arr);
 <div class="clear">
                 
              
              
        
            </div>
</tbody></a></td>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn