public String sanitizeInput(String input) {
    if (input != null) {
      for (String unsafeTag : unsafeTags) {
        String unsafeRegex = "<" + unsafeTag + ">(.*)</" + unsafeTag + ">";
        Pattern pattern = Pattern.compile(unsafeRegex);
        Matcher matcher = pattern.matcher(input);
        if (matcher.find()) {
          input = matcher.replaceAll("");
        }
      }

      String onclickRegex = "onclick=[\"'](.*)[\"']";
      Pattern pattern = Pattern.compile(onclickRegex);
      Matcher matcher = pattern.matcher(input);
      if (matcher.find()) {
        input = matcher.replaceAll("");
      }
    }
    return input;
  }
@Test
  void sanitizeInput() {
    String input = "This is "
        + "<script>alert(1);</script> "
        + "<div onclick='alert(2)'>this is div</div> "
        + "text";
    String output = md.sanitizeInput(input);
    assertFalse(output.contains("<script>"));
    assertFalse(output.contains("onclick"));
    assertTrue(output.contains("this is div"));
  }