Micro Focus QTP (UFT) Forums
trying to test that field doesn't have numeric characters - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: trying to test that field doesn't have numeric characters (/Thread-trying-to-test-that-field-doesn-t-have-numeric-characters)



trying to test that field doesn't have numeric characters - jayraocourts - 10-25-2019

Trying to check if a field "Last" has numeric characters in field, if so to say so. I tried incorporating some code found on line with mine but getting errors. Can anyone help?

**Below is My Code to test field is blank , this part works ***
Browser("Browser1").Page("page").WebEdit("WebEdit_2").Set datatable("Last")

Dim ValTxt2, objRegEx, colMatches
ValTxt2= Browser("Browser1").Page("page").WebEdit("WebEdit_2").GetROProperty("value")

If ValTxt2="" Then

Browser("Browser2").Page("page2").Output CheckPoint("browser3")

Else
*************************************************

** downloaded code below is giving the trouble when trying to incorporate with top code**
objRegEx.Global = True

objRegEx.Pattern = “[0-9]”


strSearchString = ValTxt2


Set colMatches = objRegEx.Execute(strSearchString)  


If colMatches.Count > 0 Then

    Wscript.Echo “The following characters are not allowed:”

    For Each strMatch in colMatches

        Wscript.Echo  strMatch.Value

    Next

End If

End If