fork(2) download
  1. class Main
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. String test = "<p dir=\"ltr\"><b><b><b><b><b>qwert</b></b></b></b></b><b><b><b><b><b><b>y</b></b></b></b></b></b></p>";
  6. String out = test.replaceAll("(<[^>]+>)\\1+", "$1");
  7. System.out.println("OutPut: "+out);
  8. }
  9. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
OutPut: <p dir="ltr"><b>qwert</b><b>y</b></p>