fork download
  1. class Ideone {
  2.  
  3. private static final String PATTERN = "<(\\w+).*?>(.*?)</(\\1)>";
  4.  
  5. private static final String REPLACEMENT = "<$1>$2</$1>";
  6.  
  7. public static void main (String[] args) throws Exception {
  8. String text = "<img url='blah'>text</img>";
  9. System.out.println(text.replaceAll(PATTERN, REPLACEMENT));
  10. }
  11. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
<img>text</img>