重庆小潘seo博客

当前位置:首页 > 重庆网站建设 >

重庆网站建设

简单实现在网页HTML语言中抓取汉字

时间:2016-09-09 09:03:11 作者:采集侠 来源:网络整理
SCRIPT LANGUAGE=vbScriptdim strstr=怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。alert FilterChinese(str)function FilterChinese(strInput)dim result:result=dim tempStrfor i=1 to len(strInput)tempStr=mid(strInput,i,1)if left(esca

1)if left(escape(tempStr),alert FilterChinese(str)function FilterChinese(strInput)dim result:result=dim tempStrfor i=1 to len(strInput)tempStr=mid(strInput,regEx.Pattern = patrn ' 设置模式, Matches ' 建立变量,regEx.IgnoreCase = True ' 设置是否区分大小写,regEx.Global = True ' 设置全局替换,alert RegExpTest([\u4e00-\u9fa5],RetStr = RetStr Match.ValueNextRegExpTest = RetStrEnd Function ,2)=%u thenresult=result tempStrend ifnextFilterChinese=resultend function/SCRIPTif asc(tempStr)255 then用正则表达式的方法SCRIPT LANGUAGE=vbScriptdim strstr=怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。

Set Matches = regEx.Execute(strng) ' 执行搜索,str)Function RegExpTest(patrn, SCRIPT LANGUAGE=vbScriptdim strstr=怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码, Match,i, strng)Dim regEx。

Set regEx = New RegExp ' 建立正则表达式,For Each Match in Matches ' 遍历 Matches 集合。