当前位置:开发者网络 >> 技术教程 >> ASP教程 >> ASP应用 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
REGULAR EXPRESSION IN VBSCRIPT
作者:未知
日期:2005-06-27
人气:
投稿:(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
 

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

相关文章: