wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes how can i validate the ip address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how can i validate the ip address" Watch "how can i validate the ip address" New topic

how can i validate the ip address

ajay verma
Ranch Hand

Joined: Dec 10, 2007
Posts: 37
how can i validate the ip address.example are given below is invalid is invalid is invaid

hint: with the help of String tokenize()
Rob Spoor

Joined: Oct 27, 2005
Posts: 19653

First of all, and are perfectly valid. Just because they have an extra 0 doesn't mean they aren't valid. is equal to

Second, use String.split instead, using "\\." as the regex. The \\ will be resolved to a single \ for the regex, which is used to escape the .

How To Ask Questions How To Answer Questions
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
give it a try,
if you need help, let us know,
post the code,

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
I agree. Here's the link: http://aspose.com/file-tools
subject: how can i validate the ip address
Similar Threads
User Input Parameters
How to find if there is a number in a string using regular expressions.
jsp forwarding to a target frame
xml validation
use case