菜头粿

查看: 232|回复: 0
打印 上一主题 下一主题

RegExp对象 正式表达式~

[复制链接]
1#
跳转到指定楼层
发表于 2009-8-29 12:10:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式



  
   
RegExp对象 正式表达式~
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 ' 遍历匹配集合。 RetStr = retstr& Match.FirstIndex '位置 RetStr = RetStr & Match.Value '返回值 retstr=retstr+"
" retstr = regEX.Replace(strng,"$1")'代换 Next RegExpTest = RetStr End Function response.write (RegExpTest("\[b\](.[^\[]*)(\[\/b\])", "asefwet2463464366666666666666666")) 现在许多论坛的UBB都用这个,不知大家对这个对像有什么理解~

2003-9-8 0:44:00   
阿克



高级模式
B Color Image Link Quote Code Smilies

本版积分规则

手机版|Archiver| 菜头粿 声明:本站所发贴子内容仅代表网友观点,不代表本站立场,严禁一切与国家法律相抵触的内容。感谢关注!
粤icp备19073828

GMT+8, 2026-7-26 14:55 , Processed in 0.105693 second(s), 16 queries .

粤东.中国

© 2007-2026 czczcz.com

快速回复 返回顶部 返回列表