日期:2014-05-17 浏览次数:20620 次
$str = '<div id="Div3" class="modResumeInfo"> <div class="title" onclick="clickLabel(rsmEduExCt)"> <div class="dcrL dcrArrowGreen"></div> <h3>外语能力</h3> </div> <div id="Div4" class="content"> <div class="workExCom">英语:读写能力精通 | 听说能力熟练</div> <div class="workExCom">韩语:读写能力一般 | 听说能力良好</div> <div class="workExCom">德语:读写能力一般 | 听说能力一般</div> </div> </div><!--modResumeInfo结束-->'; preg_match_all('@<div class="workExCom">(.+):(.+)</div>@u',$str,$match); var_dump($match[1]);
------解决方案--------------------
$str=<<< TEXT <div id="Div3" class="modResumeInfo"> <div class="title" onclick="clickLabel(rsmEduExCt)"> <div class="dcrL dcrArrowGreen"></div> <h3>外语能力</h3> </div> <div id="Div4" class="content"> <div class="workExCom">英语:读写能力精通 | 听说能力熟练</div> <div class="workExCom">韩语:读写能力一般 | 听说能力良好</div> <div class="workExCom">德语:读写能力一般 | 听说能力一般</div> </div> </div><!--modResumeInfo结束--> TEXT; preg_match_all("/<div\s+class=\"workExCom\">(.*):/",$str,$arr); print_r($arr);