code: private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
          if (searchPattern.matcher(resourceName).matches()) {
              resources.add(resourceName);
          }
      }
docs: Check if the resource match the regex.
  
  @param resources the list of found resources
  @param searchPattern the regex pattern
  @param resourceName the resource to check and to add