惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed
P
Proofpoint News Feed
AWS News Blog
AWS News Blog
GbyAI
GbyAI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
aimingoo的专栏
aimingoo的专栏
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
Martin Fowler
Martin Fowler
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Help Net Security
Cisco Talos Blog
Cisco Talos Blog
T
Troy Hunt's Blog
博客园 - 三生石上(FineUI控件)
Help Net Security
Help Net Security
V2EX - 技术
V2EX - 技术
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
C
Cyber Attacks, Cyber Crime and Cyber Security
Cloudbric
Cloudbric
H
Hacker News: Front Page
T
The Blog of Author Tim Ferriss
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
LangChain Blog
MyScale Blog
MyScale Blog
S
Security Affairs
L
Lohrmann on Cybersecurity
Recorded Future
Recorded Future
Webroot Blog
Webroot Blog
L
LINUX DO - 最新话题
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
T
Tor Project blog

博客园 - looping

小米公司招聘前端--待遇不错 插入排序 insertion_sort js实现 JSLint for EditPlus 检验js语法 ECMA-262-3 深入解析.第四章. 作用域链 Vim 简洁手册 在 JavaScript 中监听 IME 键盘输入事件 英文已如此搞笑,翻译却更加残暴 古文中惊艳的句子 Nicholas C. Zakas vs John Resig 一场关于YUI3/jQuery的精彩辩论 浅谈 Mousewheel 事件 css 圆角效果,2例 CSS HACK org.hibernate.TransientObjectException: object references an unsaved t... jquery 1.4 append 用法 [JavaScript]ECMA-262 深入解析 IIS 7.5 下PHP(FastCGI模式)配置手记 Remove duplicates from Array移除数组重复元素 js 翻转颜色 difference between echo and print in php
获取文本中img路径(不是dom中的)
looping · 2010-04-29 · via 博客园 - looping
======
有待改进,暂时先这样
<script type="text/javascript">
    var str =
'<div><img src="/uploads/allimg/100429/1_100429134118_1.jpg" /><br />'+
'<img  src="/uploads/allimg/100429/1_100429134118_2.jpg" /><br />'+
'<img src="/uploads/allimg/100429/1_100429134118_3.jpg" /></div>';
function getIMG(str) {
    var reg = new RegExp("<img[^>]* src=\"([^\"]*)\"[^>]*>","gi");
    var arrIMG = str.match(reg);
    var newIMG = [];
    for (var i in arrIMG) {
        var t = arrIMG[i].replace(reg, "$1");
        newIMG.push(t);
    }
    return newIMG;
}
var imgs = getIMG(str);
for (var i in imgs) {
    alert(imgs[i]);
}
======好的方法
function getIMG(str) {
    var reg = new RegExp("<img[^>]* src=\"([^\"]*)\"[^>]*>", "gi"),t,arrIMG=[];
    while (t = reg.exec(str)) {
        arrIMG.push(t[1]);
    }
    return arrIMG;
}
 
</script>