fork(1) 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.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13.  
  14.  
  15. String a = "Basic";
  16. String b = "Bas*";
  17.  
  18. boolean matches = Pattern.matches(b, a);
  19. System.out.println("1) "+matches);
  20.  
  21.  
  22. String text2 =
  23. "This is the text to be searched " +
  24. "for occurrences of the pattern.";
  25.  
  26. String pattern2 = ".*is.*";
  27.  
  28. boolean matches2 = Pattern.matches(pattern2, text2);
  29.  
  30. System.out.println("matches2 = " + matches2);
  31.  
  32.  
  33. }
  34. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
1) false
matches2 = true