File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
how can i validate the ip address
Joined: Dec 10, 2007
Jan 29, 2008 08:10:00
how can i validate the ip address.example are given below
10.02.0.99 is invalid
188.8.131.52.5.6 is invalid
109.2.8.06 is invaid
hint: with the help of
Joined: Oct 27, 2005
Jan 29, 2008 08:33:00
First of all, 10.02.0.99 and 109.2.8.06 are perfectly valid. Just because they have an extra 0 doesn't mean they aren't valid. 109.2.8.06 is equal to 184.108.40.206.
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 .
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
Joined: Nov 08, 2007
Jan 29, 2008 09:26:00
give it a try,
if you need help, let us know,
post the code,
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read(
I agree. Here's the link:
subject: how can i validate the ip address
User Input Parameters
How to find if there is a number in a string using regular expressions.
jsp forwarding to a target frame
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014