網域查詢: www.
返回首頁

REGULAR EXPRESSION IN VBSCRIPT

時間:2010-02-13 00:35來源: 作者: 點擊:
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
  

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


頂一下
(0)
0%
踩一下
(0)
0%
------分隔線----------------------------
最新評論 查看所有評論
發表評論 查看所有評論
請自覺遵守互聯網相關的政策法規,嚴禁發佈色情、暴力、反動的言論。
評價:
表情:
用戶名: 密碼: 驗證碼:
推薦內容