动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   VBScript → 阅读文章

 VBScript Execute 方法

作者来源: 
阅读 数 125 人次 , 2006-4-2 23:58:00 

execute 方法

对指定的字符串执行正则表达式搜索。

object.execute(string)

参数

object

必选项。总是一个 regexp 对象的名称。

string

必选项。要在其上执行正则表达式的文本字符串。

说明

正则表达式搜索的设计模式是通过 regexp 对象的 pattern 来设置的。

execute 方法返回一个 matches 集合,其中包含了在 string 中找到的每一个匹配的 match 对象。如果未找到匹配,execute 将返回空的 matches 集合。

下面的代码说明了 execute 方法的用法。

function regexptest(patrn, strng)
  dim regex, match, matches   ' create variable.
  set regex = new regexp     ' create a regular expression.
  regex.pattern = patrn     ' set pattern.
  regex.ignorecase = true     ' set case insensitivity.
  regex.global = true     ' set global applicability.
  set matches = regex.execute(strng)  ' execute search.
  for each match in matches   ' iterate matches collection.
    retstr = retstr & "match found at position "
    retstr = retstr & match.firstindex & ". match value is '"
    retstr = retstr & match.value & "'." & vbcrlf
  next
  regexptest = retstr
end function
msgbox(regexptest("is.", "is1 is2 is3 is4"))
 本文Tags组网  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:VBScript Raise 方法
· 下一篇:VBScript Clear 方法
· VBScript Minute 函数
· VBScript Space 函数
· VBScript LoadPicture 函数
· VBScript 中Initialize 事件
· VBScript CBool 函数


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077