Java examples for java.util.regex:Match URL
check URL by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { public static boolean checkURL(String url) { String regex = "(https?://(w{3}\\.)?)?\\w+\\.\\w+(\\.[a-zA-Z]+)*(:\\d{1,5})?(/\\w*)*(\\??(.+=.*)?(&.+=.*)?)?"; return Pattern.matches(regex, url); }/*from w w w. j a v a2 s.co m*/ }