class DiffTools {

  private final static Pattern subIdPattern = Pattern.compile("\\[(\\d+)\\]");

  private DiffTools() {
  }
  
  static String getMasterId(String ruleId) {
    return ruleId.replaceFirst("\\[\\d+\\]", "").trim();
  }

  @Nullable
  static String getSubId(String ruleId) {<FILL_FUNCTION_BODY>}

}

    Matcher matcher = subIdPattern.matcher(ruleId);
    if (matcher.find()) {
      return matcher.group(1);
    } else {
      return null;
    }
  
<no_super_class>