首页 > 开发 > 综合 > 正文

REGULAR EXPRESSION IN VBSCRIPT

2024-07-21 02:15:30
字体:
来源:转载
供稿:网友
  • 网站运营seo文章大全
  • 提供全面的站长运营经验及seo技术!
  •  

    regular expression in vbscript
    object regexp is used to create and execute regular expression

    ex.
    code:
    strtarget="test testing tested attest late start"
    set objregexp= new regexp   'create a regular expression

    objregexp.pattern="test*"   'set the search pattern
    objregexp.ignorecase=false  'set the case sensitivity
    objregexp.global=true       'set the scope

    set colmatches=objregexp.execute(strtarget)  'execute the search

    for each match in colmathes                  'iterate the colmatches collection
     response.write "match found at position" & match.firstindex & "."
     response.write "matched value is '" & match.value & "',<br>"
    next

    tested result:
    match found at position 0. matched value is 'test'.
    match found at position 5. matched value is 'test'.
    match found at position 13. matched value is 'test'.
    match found at position 22. matched value is 'test'.

    发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表