private static Pattern anchored(String regex){
  return Pattern.compile("^" + regex + "$");
}

private static Pattern anchored ( String regex ) { return Pattern . compile ( "^" + regex + "$" ) ; }
returns a pattern , anchored at the beginning and end , for the regex .
