正则匹配Ueditor中得到的文本中的自己上传的图片链接

<?php
$text="<p>good<img src=\"http://img.baidu.com/hi/tsj/t_0037.gif\" /></p><p><img src=\"http://uppic.b0.upaiyun.com/2013/5/5/1367741844238814.png_440\" style=\"float:none;\" /></p><p><img src=\"http://uppic.b0.upaiyun.com/2013/5/5/1367741858405222.png_440\" style=\"float:none;\" /></p><p>test</p><p><img src=\"http://img.baidu.com/hi/tsj/t_0036.gif\" /></p><p>good</p><p><br /></p>";
$text=stripslashes($text);
//正则
$preg = "|<img src=\"(http:\/\/uppic.b0.upaiyun.com.+?)\".*?>|"; preg_match_all($preg,$text,$res); print_r($res[1]);die;// 结果是:Array ( [0] => http://uppic.b0.upaiyun.com/2013/5/5/1367741844238814.png_440 [1] => http://uppic.b0.upaiyun.com/2013/5/5/1367741858405222.png_440 ) ?>

 

posted @ 2013-05-06 10:11  不负韶华668  阅读(954)  评论(0编辑  收藏  举报