fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.*;
  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. Pattern pattern = Pattern.compile("^\\s*$", Pattern.MULTILINE);
  13. Matcher matcher = pattern.matcher("");
  14.  
  15. if (matcher.find()) {
  16. System.out.println("Multiline: true");
  17. } else {
  18. System.out.println("Multiline: false");
  19. }
  20.  
  21. Pattern pattern2 = Pattern.compile("^\\s*$");
  22. Matcher matcher2 = pattern2.matcher("");
  23.  
  24. if (matcher2.find()) {
  25. System.out.println("Non-Multiline: true");
  26. } else {
  27. System.out.println("Non-Multiline: false");
  28. }
  29. }
  30. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
Multiline: false
Non-Multiline: true