Thanks to visit codestin.com
Credit goes to playjava.wordpress.com

Main menu

Skip to content
  • About
  • Downloads
  • Java Articles
  • Java Question & Answers
    • Does Java pass by reference or pass by value?
    • Explain public static void main (String args[])…..
    • What are Variable Arity methods?
    • What are web applications?
    • What is java Reflection?

Play Java – Kickstart

Java Addicted

RSS

Tag Archives: Validation

Validate IP Address

Posted by Abhishek Anne on November 23, 2010

Usage of regular expression in Java to validate an IP address
Code:


private boolean
validateAnIpAddressWithRegularExpression(String iPaddress){
final Pattern IP_PATTERN =
Pattern.compile("b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).)"
+ "{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)b");
return IP_PATTERN.matcher(iPaddress).matches();
}

Leave a comment Posted in Java Basics Tagged IP Addresss, regular expression, Validation

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 33 other subscribers

Categories

  • Handling Files (5)
  • J2EE (2)
  • Java Basics (9)
    • Date & Time (3)
  • Java Reflection (1)
  • Java Swing Examples (7)
  • JDBC (1)
  • Linux (1)
  • Network Appication (3)
  • Servelet (2)
  • String (1)
  • Uncategorized (3)

Like Us

Like Us

RSS

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Tags

compile databse pooling Date Format Date SimpleDateFormat ignorecase IP Addresss java java.util.date java collection java date format java reflection api JAVIAN JDBC mdb msaccess notepad++ regular expression replaceAllIgnoreCase replaceAll method replacement string run SimpleDateFormat String tomcat tomcat7 Validation websocket java javaEE6 tomcat javascript HTML5 JSR356 RFC6455

Twitter

Tweets by abhishekanne

Live Traffic

http://feedjit.com/serve/?vv=1515&tft=3&dd=0&wid=&pid=0&proid=0&bc=FFFFFF&tc=000000&brd1=012B6B&lnk=135D9E&hc=FFFFFF&hfc=2853A8&btn=C99700&ww=200&went=10Live Traffic Stats

Blog at WordPress.com.

  • Subscribe Subscribed
    • Play Java - Kickstart
    • Join 33 other subscribers
    • Already have a WordPress.com account? Log in now.
  • Privacy
    • Play Java - Kickstart
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Design a site like this with WordPress.com
Get started