Home > Backend Development > PHP Tutorial > 一个正则有关问题

一个正则有关问题

WBOY
Release: 2016-06-13 10:27:12
Original
907 people have browsed it

一个正则问题

1主题内容与适用范围

2原理

3试剂

4仪器、设备

5采样及样品保存


要截取出../2003Z/hb/z063.pdf这个结果,该怎么截取呢?



------解决方案--------------------
PHP code
$str=1主题内容与适用范围<div id="divPdf1" title="../2003Z/hb/z063.pdf#page=2" class="downpdf" style="cursor:hand;">2原理</div><div id="divPdf2" title="../2003Z/hb/z063.pdf#page=2" class="downpdf" style="cursor:hand;">3试剂</div><div id="divPdf3" title="../2003Z/hb/z063.pdf#page=4" class="downpdf" style="cursor:hand;">4仪器、设备</div><div id="divPdf4" title="../2003Z/hb/z063.pdf#page=4" class="downpdf" style="cursor:hand;">5采样及样品保存</div>STR;preg_match('/<div.></div.><font color="#e78608">------解决方案--------------------</font><br>preg_match('/title="([^#\"]+)#/s',$s,$m);<br>prinit_r($m[1]);<br><font color="#e78608">------解决方案--------------------</font><br>/<img  src="%5C/images%5C/(.*?)" alt="一个正则有关问题" ><font color="#e78608">------解决方案--------------------</font><br>/<img  src="%5C/images%5C/(.*)" alt="一个正则有关问题" ><font color="#e78608">------解决方案--------------------</font><br> $contents = $match[1];<br>foreach($contents as &$v) $v='http://localhost/'.$v;<br>    $contents = implode('#',$contents);<br>   echo $contents;<div class="clear">
                 
              
              
        
            </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