Micro Focus QTP (UFT) Forums
How to check if string contains only numeric value if range is not given - 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: How to check if string contains only numeric value if range is not given (/Thread-How-to-check-if-string-contains-only-numeric-value-if-range-is-not-given)



How to check if string contains only numeric value if range is not given - blanchedsouza - 06-12-2008

Hi,

In my application, when new object is created, a new window opens with title: object's name and its ID.

e.g. ABC 45732547 or ABC 8679

ABC is object's name and ID is only numeric value which keeps increasing and its range is not given.

can anyone tell me the regular expression to check only for numeric value after object's name. e.g. "ABC 564jhj44" should not work.


RE: How to check if string contains only numeric value if range is not given - niranjan - 06-13-2008

One way to do it is, store that windows title in a variable.
Split this variable so that ABC and 8679 or whatever are separate.
Now use Cint and then check with IsNumeric function.


RE: How to check if string contains only numeric value if range is not given - surya_7mar - 07-28-2008

You can also use regular expresion to do this.
here is the regular expressionto verify this
.* \d*

Allows only "asdfsdf 1232451234" it will not allow "asdfasd 123sdf123"


RE: How to check if string contains only numeric value if range is not given - kishoreinchennai - 09-19-2008

objRegExpr.Pattern = "[A-Za-z]+ ?[0-9]"

regards
Kishore