如何从Html页面中提取所有汉字

taito 2005-12-02 02:44:53
怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。

请指教!
...全文
129 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
taito 2005-12-02
  • 打赏
  • 举报
回复
强!
超级大笨狼 2005-12-02
  • 打赏
  • 举报
回复
用正则表达式的方法
<SCRIPT LANGUAGE="vbScript">
dim str
str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"
alert RegExpTest("[\u4e00-\u9fa5]",str)



Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
regEx.Global = True ' 设置全局替换。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match in Matches ' 遍历 Matches 集合。
RetStr = RetStr & Match.Value
Next
RegExpTest = RetStr
End Function

</SCRIPT>
超级大笨狼 2005-12-02
  • 打赏
  • 举报
回复
if asc(tempStr)>255 then
超级大笨狼 2005-12-02
  • 打赏
  • 举报
回复
<SCRIPT LANGUAGE="vbScript">
dim str
str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"
alert FilterChinese(str)

function FilterChinese(strInput)
dim result:result=""
dim tempStr
for i=1 to len(strInput)
tempStr=mid(strInput,i,1)
if left(escape(tempStr),2)="%u" then
result=result & tempStr
end if
next
FilterChinese=result
end function

</SCRIPT>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧