Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ip addres reg ex

Status
Not open for further replies.

gregaug

Programmer
Sep 9, 2005
61
US
hello,

I'm new to vbs, and I'm trying to run a script where a user can enter an ip address. I'm just trying to simply test to make sure a valid ip was sent in, i.e. 4 numbers from 0-255 separated by a dot. I can't seem to get the right regex or code to check it. Can someone please help?
 
you can also use:
Code:
parts = split(ip_addr,".")
if int(parts(0)) =< 255 and 
   int(parts(1)) =< 255 and 
   int(parts(2)) =< 255 and 
   int(parts(3)) =< 255       then 
 '  the address is correct
end if.
 
Line break _must_ be continued explicitly.
[tt]
if int(parts(0)) =< 255 and [red]_[/red]
int(parts(1)) =< 255 and [red]_[/red]
int(parts(2)) =< 255 and [red]_[/red]
int(parts(3)) =< 255 then
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top