public static boolean hasGroup(Matcher matcher){
  return matcher.groupCount() > 0;
}

public static boolean hasGroup ( Matcher matcher ) { return matcher . groupCount ( ) > 0 ; }
check whether a matcher contains a group or not .
