Micro Focus QTP (UFT) Forums
How to Use Regular Expression for IP Address - 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 Use Regular Expression for IP Address (/Thread-How-to-Use-Regular-Expression-for-IP-Address)



How to Use Regular Expression for IP Address - kamakhi.panda - 08-12-2008

Hi All,
How to Use Regular Expression for IP Address..I want to check the Address in the range 0-255.
so i used the Regex like (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)

But i am getting confuse where i have to apply this Regex.

For Ex i have one Filed GateWay..its a Text Box
so properties are type,name,html tag,Value,Default Value...

Code:
Browser("xyz").page("xyz").WebEdit("gateway").set "192.168.1.25"
So in above script i want to use Regex..

so please tell me the flow where i have to put Regex...i mean on which property and how to put??


RE: How to Use Regular Expression for IP Address - kishoreinchennai - 09-03-2008

ok

First do u want to set or validate an Ip Address ?!!!!!

in set i dont see any use of regular expression

If u want to validate the simplest thing would be

Get the octet and see if it is between 0 to 255 and again

Do you have a Class restriction onthe Ip address

regards
Kishore