I have been trying to implement regular expression in VB Script.
Dim regEx, objMatch, objMatches, strReturn
Dim strPattern="This is test String for Reg Exp"
Set regEx = New RegExp
regEx.Pattern = [a-z]
regEx.IgnoreCase = True
regEx.Global = True
strReturn = strReturn & vbCRLF
This should work. This sample will replace whitespace from a string and replace it with a single quote.
regEx.Global = true
regEx.Pattern = "^[ t]+|[ t]+$"
' Input a string to test our replace functionality:
strText = " Starfish Regular Expression Test "
' Call Replace method of the regular expression:
' the $1 means place the matching text here
strReturn = regEx.Replace(strText, "'")
'Starfish Regular Expression Test'
Login or sign up for our forums to connect to the user community.
You must log in to post.
Not a Member? Register.