fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11.  
  12. String str = new String("prueba.txt");
  13.  
  14.  
  15. System.out.println(str + " " + str.matches("(.*)\\.txt"));
  16.  
  17. str = "prueba.pdf";
  18.  
  19. System.out.println(str + " " + str.matches("(.*)\\.txt"));
  20.  
  21.  
  22.  
  23. }
  24.  
  25.  
  26.  
  27. }
Success #stdin #stdout 0.1s 27892KB
stdin
Standard input is empty
stdout
prueba.txt true
prueba.pdf false