public static final boolean contains(String input,String pattern,boolean ignoreCase){
  final int n=pattern.length();
  int last=0;
  for (int i=0; i < n; ) {
    char c=' ';
    int j=i;
    for (; j < n; j++) {
      char c2=pattern.charAt(j);
      if (c2 == ' ' || c2 == '+' || c2 == '*') {
        c=c2;
        break;
      }
    }
    int k=subset(pattern,i,j,input,last,ignoreCase);
    if (k < 0)     return false;
    if (c == ' ' || c == '+')     last=0;
 else     if (c == '*')     last=k + j - i;
    i=j + 1;
  }
  return true;
}

public static final boolean contains ( String input , String pattern , boolean ignoreCase ) { final int n = pattern . length ( ) ; int last = 0 ; for ( int i = 0 ; i < n ; ) { char c = ' ' ; int j = i ; for ( ; j < n ; j ++ ) { char c2 = pattern . charAt ( j ) ; if ( c2 == ' ' || c2 == '+' || c2 == '*' ) { c = c2 ; break ; } } int k = subset ( pattern , i , j , input , last , ignoreCase ) ; if ( k < 0 ) return false ; if ( c == ' ' || c == '+' ) last = 0 ; else if ( c == '*' ) last = k + j - i ; i = j + 1 ; } return true ; }
exactly like contains ( input , pattern ) , but case is ignored if ignorecase = = true .
