public static boolean match(String value,String strPattern){
  if (isNotEmpty(strPattern)) {
    if (isBlank(value)) {
      return strPattern.equals("*");
    }
    value=value.toLowerCase();
    strPattern=strPattern.toLowerCase();
    StringBuilder buff=new StringBuilder();
    for (int i=0; i < strPattern.length() - 1; i++) {
      char c=strPattern.charAt(i);
      if (c == '*') {
        buff.append(".*?");
      }
 else {
        buff.append(c);
      }
    }
    char lastChar=strPattern.charAt(strPattern.length() - 1);
    if (lastChar == '*') {
      buff.append(".*");
    }
 else {
      buff.append(lastChar);
    }
    return Pattern.matches(buff.toString(),value);
  }
  return true;
}

public static boolean match ( String value , String strPattern ) { if ( isNotEmpty ( strPattern ) ) { if ( isBlank ( value ) ) { return strPattern . equals ( "*" ) ; } value = value . toLowerCase ( ) ; strPattern = strPattern . toLowerCase ( ) ; StringBuilder buff = new StringBuilder ( ) ; for ( int i = 0 ; i < strPattern . length ( ) - 1 ; i ++ ) { char c = strPattern . charAt ( i ) ; if ( c == '*' ) { buff . append ( ".*?" ) ; } else { buff . append ( c ) ; } } char lastChar = strPattern . charAt ( strPattern . length ( ) - 1 ) ; if ( lastChar == '*' ) { buff . append ( ".*" ) ; } else { buff . append ( lastChar ) ; } return Pattern . matches ( buff . toString ( ) , value ) ; } return true ; }
match the value to the regular expression pattern . the pattern given can contain a file name like search , e . g . ' * service * ' , which will be converted to a valid regular expression , e . g . ' . * ? service . * ' .
