fork(8) download
  1. import java.util.Arrays;
  2.  
  3. class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. String string = "hello^world'this*has two tokens'#2ndToken";
  8. System.out.println(Arrays.toString(string.split("(?=(([^']+'){2})*[^']*$)[^a-zA-Z\\d]+")));
  9. }
  10. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
[hello, world'this*has two tokens', 2ndToken]