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

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

WBOY
Release: 2016-06-13 11:38:42
Original
912 people have browsed it

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

$reg="/<img \s*.*src\s*=\s*[\"|\']?\s*([^ alt="求问一个正则表达式的有关问题" >\"\']*)/i";
Copy after login


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

只能匹配到:

到空格的时候就终止了?
([^>\"\']*)这个条件应该不包含空格啊?

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

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

)

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