MsgBox LocateText("www.QTPHelper.com", "QTP")
MsgBox LocateText("www.QTPHelper.com", "QTP.*.com")
' =============================================================
' function: LocateText
' desc : Uses a regular expression to locate text within a string
' params : strString is the string to perform the search on
' strPattern is the regular expression
' returns : True if the pattern was found, False otherwise
' =============================================================
Function LocateText(strString, strPattern)
Dim objRegEx
' create the regular expression
Set objRegEx = New RegExp
' set the pattern
objRegEx.Pattern = strPattern
' ignore the casing
objRegEx.IgnoreCase = True
' perform the search
LocateText = objRegEx.Test(strString)
' destroy the object
Set objRegEx = Nothing
End Function ' LocateText
MsgBox LocateText("www.QTPHelper.com", "QTP.*.com")
' =============================================================
' function: LocateText
' desc : Uses a regular expression to locate text within a string
' params : strString is the string to perform the search on
' strPattern is the regular expression
' returns : True if the pattern was found, False otherwise
' =============================================================
Function LocateText(strString, strPattern)
Dim objRegEx
' create the regular expression
Set objRegEx = New RegExp
' set the pattern
objRegEx.Pattern = strPattern
' ignore the casing
objRegEx.IgnoreCase = True
' perform the search
LocateText = objRegEx.Test(strString)
' destroy the object
Set objRegEx = Nothing
End Function ' LocateText
0 comments:
Post a Comment