繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> ASP基础 >> REGULAR EXPRESSION IN VBSCRIPT

REGULAR EXPRESSION IN VBSCRIPT

2006-01-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介: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 regu...

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 & "',

"

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'.

责任编辑:admin
相关文章