Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /** * check if string is a url * use regular expressionn ^http(s)?:\/\/(.*?) */ public static Boolean hasUrlFormat(String str) { Boolean isUrl = false; Pattern p = Pattern.compile("^http(s)?:\\/\\/(.*?)"); Matcher m = p.matcher(str); if (m.find()) isUrl = true; return isUrl; } }