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.