code: public static SourceInformation from(Pattern sourceRegex, String name) {
          if (sourceRegex == null) {
              return new SourceInformation(null, name);
          }
          Matcher matcher = sourceRegex.matcher(name);
          if (matcher.groupCount() != 1) {
              log.error("Source regex matcher must define a group");
              return new SourceInformation(null, name);
          }
          if (!matcher.find()) {
              return new SourceInformation(null, name);
          }
          String source = matcher.group(1);
          int endPos = matcher.toMatchResult().end();
          if (endPos >= name.length()) {
              // the source matched the whole metric name, probably in error.
              log.error("Source '{}' matched the whole metric name. Metric name cannot be empty");
              return new SourceInformation(null, name);
          }
          String newName = name.substring(endPos);
          return new SourceInformation(source, newName);
      }
docs: If the pattern is not null, it will attempt to match against the supplied name to pull out the source.