private static @Nullable Selector getSelector(@NotNull List<MarkupNode> markupNodes, @NotNull Map<String, Attribute> attrs,
                                                @NotNull String tagName) {
    Attribute substring = attrs.get("substring");
    Attribute regex = attrs.get("regex");
    if (substring == null && regex == null) return new WholeLine();
    if (substring != null && regex != null) {
      markupNodes.add(new ErrorMarkup(regex.range(), JavaBundle.message("javadoc.snippet.error.both.substring.and.regex", tagName)));
      return null;
    }
    if (regex == null) return new Substring(substring.value());
    try {
      return new Regex(Pattern.compile(regex.value()));
    }
    catch (PatternSyntaxException e) {
      markupNodes.add(new ErrorMarkup(regex.range(),
                                      JavaBundle.message("javadoc.snippet.error.malformed.regular.expression", tagName, e.getMessage().replace("\r\n", "\n"))));
      return null;
    }
  }
private static @Nullable Selector getSelector(@NotNull List<MarkupNode> markupNodes, @NotNull Map<String, Attribute> attrs,
                                                @NotNull String tagName)