Possible Duplicate:
Validating an IP with regex
I need the regular expression for finding strings like followings in Java:
http://69.39.233.135:8032
http://83.133.127.104
http://119.207.75.238:11120
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This pattern would fetch the desired results:
Matches an IP after http:// with an optional port.
Note that this is a simplified validation of an IPv4 and will only match that they are one the correct format and not a valid one. And remember to add an extra backslash to escape each backslash in java.
Here’s an example in java:
Output: