Home > Backend Development > PHP Tutorial > 求正则表达式?解决方案

求正则表达式?解决方案

WBOY
Release: 2016-06-13 09:59:10
Original
898 people have browsed it

求正则表达式???????????????急
$str = '




外语能力



 
   
英语:读写能力精通 | 听说能力熟练


韩语:读写能力一般 | 听说能力良好


德语:读写能力一般 | 听说能力一般


 

我想取出英语 韩语 德语这三个词,用正则表达是怎么写?
用这种格式:
前字符串(?[\s\S]*?)后字符串

------解决方案--------------------
PHP code
$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]);<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
PHP code
$str=<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>   <!--modResumeInfo结束-->TEXT;preg_match_all("/<div>(.*):/",$str,$arr);print_r($arr);<div class="clear">
                 
              
              
        
            </div>
</div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template