C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Validate an IP address


Posted Date: 11 Mar 2004    Resource Type: Articles    Category: .NET Framework
Author: Satheesh SugumaranMember Level: Gold    
Rating: Points: 5




' Validate an IP address
' Example:
' MessageBox.Show(IsValidIP("123.14.0.255")) ' => True
' MessageBox.Show(IsValidIP("256.14.0.255")) ' => False


Function ChkValidIP(ByVal ipAddress As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(ipAddress, _
"^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$")
End Function




Responses

Author: naveen    02 Sep 2004Member Level: Bronze   Points : 0
Hi ,
I was looking for the code to validate IP address. U r code is great. Hats off to u


Author: Manny Duarte    08 Sep 2004Member Level: Bronze   Points : 0
To get a valid IP, you should use the following expression. Reason being is that the last octect has to be less than 255.

^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){2}(\.(25[0-4]|2[0-4]\d|[0-1]?\d?\d))$



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Windows Services Part I
Previous Resource: Download the HTML at a given URL
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use