private String match(Pattern re){
  if (index >= input.length()) {
    return null;
  }
  Matcher matcher=re.matcher(input);
  matcher.region(index,input.length());
  boolean m=matcher.find();
  if (m) {
    index=matcher.end();
    return matcher.group();
  }
 else {
    return null;
  }
}

private String match ( Pattern re ) { if ( index >= input . length ( ) ) { return null ; } Matcher matcher = re . matcher ( input ) ; matcher . region ( index , input . length ( ) ) ; boolean m = matcher . find ( ) ; if ( m ) { index = matcher . end ( ) ; return matcher . group ( ) ; } else { return null ; } }
if re matches at current index in the input , advance index and return the match ; otherwise return null .
