Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isMatcherFinded(String patternStr, CharSequence input) { if (!isNullOrEmpty(patternStr) && null != input) { Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(input); if (null != matcher && matcher.find()) { return true; } } return false; } public static boolean isNullOrEmpty(String str) { return null == str || str.trim().length() < 1; } }