private static int findWordStart(String text,int pos){
  Matcher m=WORD.matcher(text);
  int temp=-1;
  while (m.find()) {
    if (m.start() > pos) {
      break;
    }
 else {
      temp=m.start();
    }
  }
  int start=temp;
  if (start == -1) {
    start=0;
  }
  return start;
}

private static int findWordStart ( String text , int pos ) { Matcher m = WORD . matcher ( text ) ; int temp = - 1 ; while ( m . find ( ) ) { if ( m . start ( ) > pos ) { break ; } else { temp = m . start ( ) ; } } int start = temp ; if ( start == - 1 ) { start = 0 ; } return start ; }
find the beginning of the word at the given position .
