code: public static int getCount(Matcher matcher) {
          int counter = 0;
          matcher.reset();
          while (matcher.find()) {
              counter++;
          }
          return counter;
      }
docs: Find the number of Strings matched to the given Matcher.
  
  @param matcher a Matcher
  @return int  the number of Strings matched to the given matcher.
  @since 1.0