Published in: ASP
URL: http://reusablecode.blogspot.com/2008/07/isvalidip.html
<% ' Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Validate an IP address. function isValidIP(ip) dim regEx set regEx = new RegExp with regEx .IgnoreCase = True .Global = True .Pattern = "^([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){3}$" end with if regEx.Test(trim(CStr(ip))) then isValidIP = True else isValidIP = False end if set regEx = nothing end function %>
You need to login to post a comment.
