- /**
- * 获取字符串中的图片
- */
- function getContentImg(str)
- {
- var r, re, img_str = '';
- re = /<[img|href][^>]*src\\s*=\\s*('|")?([^'">]*)\\1([^>])*>/ig;
- while ((r = re.exec(str)) != null) {
- img_str = img_str + r[2] + ',';
- }
- img_str = img_str == '' ? '' : img_str.substring(0, img_str.length-1);
- return img_str;
- }
- //该片段来自于http://www.codesnippet.cn/detail/311020136843.html
来源: http://www.codesnippet.cn/detail/311020136843.html