日期:2014-05-18  浏览次数:20891 次

求正则表达式截取上传图片路径!!!!1
图片路径为

<p> <img   class= " "   height= "90 "   width= "900 "   alt= " "   src= "/FCKeditor/UserFiles/Image/100009.gif "   /> </p>
需要截取/UserFiles/Image/100009.gif,正则表达式如何写啊!急求!!如何用Javascript实现

------解决方案--------------------
<script language=javascript>
function matchUrl(strUrl)
{
return /\/UserFiles\/Image\/[^.]*\.(?:jpg|bmp|gif)/.exec(strUrl);
}

alert(matchUrl( " <p> <img class=\ "\ " height=\ "90\ " width=\ "900\ " alt=\ "\ " src=\ "/FCKeditor/UserFiles/Image/100009.gif\ " /> </p> "));
</script>