fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String s = "[hello world]";
  13. s = s.replaceAll("[][]","");
  14. System.out.println(s);
  15. }
  16. }
Runtime error #stdin #stdout #stderr 0.07s 380224KB
stdin
Standard input is empty
stdout

Standard output is empty

stderr
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 3
[][]
   ^
	at java.util.regex.Pattern.error(Pattern.java:1924)
	at java.util.regex.Pattern.clazz(Pattern.java:2493)
	at java.util.regex.Pattern.clazz(Pattern.java:2449)
	at java.util.regex.Pattern.sequence(Pattern.java:2030)
	at java.util.regex.Pattern.expr(Pattern.java:1964)
	at java.util.regex.Pattern.compile(Pattern.java:1665)
	at java.util.regex.Pattern.<init>(Pattern.java:1337)
	at java.util.regex.Pattern.compile(Pattern.java:1022)
	at java.lang.String.replaceAll(String.java:2162)
	at Ideone.main(Main.java:13)