public static boolean validate(String str,String regEx,Debug tmpDebug){
  debug=tmpDebug;
  if (str == null || str.length() == 0) {
    debug.message("Source string is null or empty");
    return false;
  }
  char[] value=str.toCharArray();
  int count=value.length;
  Set hSet=new HashSet();
  StringTokenizer st=new StringTokenizer(regEx,SEPERATOR);
  while (st.hasMoreTokens()) {
    hSet.add(st.nextToken());
  }
  Iterator itr=hSet.iterator();
  while (itr.hasNext()) {
    String obj=(String)itr.next();
    if (process(value,obj,0,count) > -1) {
      debug.message("detected invalid chars ...");
      return false;
    }
  }
  return true;
}

public static boolean validate ( String str , String regEx , Debug tmpDebug ) { debug = tmpDebug ; if ( str == null || str . length ( ) == 0 ) { debug . message ( "Source string is null or empty" ) ; return false ; } char [ ] value = str . toCharArray ( ) ; int count = value . length ; Set hSet = new HashSet ( ) ; StringTokenizer st = new StringTokenizer ( regEx , SEPERATOR ) ; while ( st . hasMoreTokens ( ) ) { hSet . add ( st . nextToken ( ) ) ; } Iterator itr = hSet . iterator ( ) ; while ( itr . hasNext ( ) ) { String obj = ( String ) itr . next ( ) ; if ( process ( value , obj , 0 , count ) > - 1 ) { debug . message ( "detected invalid chars ..." ) ; return false ; } } return true ; }
checks for invalid characters in the source string .
