2.正则获取标签
代码如下(示例):
var url = "http://www.baidu.com/";
var x = http.httpGetDefault(url, 10 * 1000, {"User-Agent": "test"});
var a = x.match(/<span class="title-content-title">([\s\S]*?)<\/span>/g);
for (var i = 0; i < a.length; i++) {
logd(a[i])
}
3.正则获取内容
代码如下(示例):
var url = "http://www.baidu.com/";
var x = http.httpGetDefault(url, 10 * 1000, {"User-Agent": "test"});
var a = x.match(/<span class="title-content-title">([\s\S]*?)<\/span>/g);
for (var i = 0; i < a.length; i++) {
var b = a[i].replace(/<span(.*)?>(.*)<\/span>(.*)/, '$2')
logd(b)
}