正则表达式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:50:471004browse

求一个正则表达式
想取得图片的src,比如
 正则表达式

如何取得   aaa.jpg

------解决方案--------------------
$s = "  正则表达式 ";
eregi( "src=[\ "|\ ']?(.*\.jpg).* ",$s,$r);
echo $r[1];
?>

结果:
1.jpg
------解决方案--------------------
$s = "一些其他代码 一些其他代码  正则表达式 一些其他代码  正则表达式 一些其他代码 ";
preg_match_all( '/\  正则表达式 /U ',$s,$m);
print_r($m[1]);
------解决方案--------------------
 正则表达式 .*?( '| ")?\s+.*>
------解决方案--------------------
大家考虑下这种情况
 正则表达式
------解决方案--------------------
答案很多,仍不严密

preg_match_all( '/\  正则表达式 ]+src[\s\r\n]*=[\s\r\n]*([\ '\ "]?)([^\> \1]+)\1[^\> ]*> /i ',$str,$matches);
print_r($matches[2]);

Statement:
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