Home > Backend Development > PHP Tutorial > 求问一个正则表达式的有关问题

求问一个正则表达式的有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:34:41
Original
1114 people have browsed it

求问一个正则表达式的问题
想匹配一个网页地址中的所有图像地址,写了正则表达式如下:

$reg="/<img  src="/static/imghw/default1.png"  data-src="../Images/Album Cover/album_012.jpg"  class="lazy" \s*.*src\s*=\s*[\"|\']?\s*([^ alt=" 求问一个正则表达式的有关问题 " >\"\']*)/i";
Copy after login


为什么像如下的图像文件地址:
<img  src="/static/imghw/default1.png"  data-src="../Images/Album Cover/album_012.jpg"  class="lazy"   alt=" 求问一个正则表达式的有关问题 " >
Copy after login

只能匹配到:
 求问一个正则表达式的有关问题 

              

Array
(
    [0] => Array
        (
            [0] =>  求问一个正则表达式的有关问题         )

    [1] => Array
        (
            [0] => ../Images/Album Cover/album_012.jpg
        )

)

Related labels:
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