Regular expression for validating hostname

If three digits appear, it must start either 0 or 1 # e.g ([0-9], [0-9][0-9],[0-1][0-9][0-9]) | # ..2[0-4]\d # start with 2, follow by 0-4 and end with any digit (2[0-4][0-9]) | # ..25[0-5] # start with 2, follow by 5 and ends with 0-5 (25[0-5]) ) # end of group #2 \. # repeat with 3 times (3x) $ #end of the line package com.mkyong.regex; import regex. Pattern; public class IPAddress Validator{ private Pattern pattern; private Matcher matcher; private static final String IPADDRESS_PATTERN = "^([01]? |2[0-4]\d|25[0-5])$"; public IPAddress Validator(){ pattern = Pattern.compile(IPADDRESS_PATTERN); } /** * Validate ip address with regular expression * @param ip ip address for validation * @return true valid ip address, false invalid ip address */ public boolean validate(final String ip){ matcher = pattern.matcher(ip); return matcher.matches(); } } 1. This can be called as either a subroutine or a method.

“22.2222.22.2” – digit must between [0-255] package com.mkyong.regex; import org.testng.If called as a method, any additional options are ignored.This returns the untainted domain name if the given is a valid domain.No blank or space characters are permitted as part of a name.

No distinction is made between upper and lower case.The first character must be an alpha character [Relaxed in RFC 1123] .


  1. Pingback:

  2. eric   •  

    It takes a commitment from both parties to make it a success. You can post your profile, search in our database, send and receive messages absolutely free. Imagine not having to type endless messages to try and get to know someone and start dating, now you can speak to the person you are interested in and find out quickly if they are compatible with you.

  3. eric   •  

    Plus come with the notes you can essentially be highest traffic means you no cheating, so many have.

  4. eric   •  

    Yes, I have a cock but just want to be a sexy lil girl for her daddy. Imagination, literacy, creativity, detail - this is what I offer, and seek, myself.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>