fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String[] strings = {
  12. " --hello;(hello;hello)hello;",
  13. "hello;(hello;hello)hello;"
  14. };
  15.  
  16. for (String s : strings) {
  17. if (!s.matches("^[ \\t]*--.*$")) {
  18. System.out.println(Arrays.toString(s.split(";(?![^()]*\\))")));
  19. }
  20. }
  21. }
  22. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
[hello, (hello;hello)hello]