code: private boolean pathologicalCase(String text)
      {
          String tag = toRegex( CollectionUtil.first( tags ));
          String regex = String.format( "(?is)(<\\s*(%s)\\s*.*?>)", tag );
          Matcher match  = compile(regex).matcher(text);
  
          if (match.find())
          {
              regex = String.format( "(?is)(.*?)(<\\s*/\\s*(%s)\\s*.*?>)", tag );
              return !compile(regex).matcher(text).find(match.end());
          }
  
          return true;
      }
docs: Most regex implementations today do not build a DFA / NFA --
  especially those that offer backreferences (which are not "regular" at all).
  
  And because they do NOT build DFAs and NFAs, it's very simple to construct pathological cases
  - e.g., "((a*)(a*))+b" can take exponentially long to decide that
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac is not in the language
  using the matching techniques commonly in use.
  
  Ori Berger