import java.util.*;import java.lang.*;import java.io.*;import java.util.regex.*; class Ideone{ public static void main (String[] args) throws java.lang.Exception { String original = "<b>hello!</b><br><br><b><u>this is an example</u></b><br>"; String separator = "(?!^)(?:(?<=>)|(?=<))"; String[] results = original.split(separator); System.out.println(Arrays.toString(results)); }}
Standard input is empty
[<b>, hello!, </b>, <br>, <br>, <b>, <u>, this is an example, </u>, </b>, <br>]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!