87,904
社区成员
发帖
与我相关
我的任务
分享
s = "<p> <embed src=\"/WebSite2/Upload/flash/890.swf\" type=\"application/x-shockwave-flash\" play=\"true\" loop=\"true\" menu=\"true\"> </embed> <img height=\"391\" width=\"480\" alt=\"\" src=\"/WebSite2/Upload/image/hello.jpg\" /> <img alt=\"\" src=\"http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif\" /> </p>"
re = /src="([^"]+.swf)"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}
re = /src="([^"]+(.jpg|.gif|.jpeg|.png))"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}
s = "<p> <embed src=\"/WebSite2/Upload/flash/890.swf\" type=\"application/x-shockwave-flash\" play=\"true\" loop=\"true\" menu=\"true\"> </embed> <img height=\"391\" width=\"480\" alt=\"\" src=\"/WebSite2/Upload/image/hello.jpg\" /> <img alt=\"\" src=\"http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif\" /> </p>"
re = /src="([^"]+)"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}
<script type="text/javascript">
<!--
var str = 's<p> <embed src="/WebSite2/Upload/flash/890.swf" type="application/x-shockwave-flash" play="true" loop="true" menu="true"> </embed> <img height="391" width="480" alt="" src="/WebSite2/Upload/image/hello.jpg" /> <img alt="" src="http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif" /></p>';
var reg = /src\s*=\s*("|')([^"]+?)\1/g;
while((result = reg.exec(str)) != null){
alert(result[2])
}
//-->
</script>