fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class MyStrMatches {
  8.  
  9. public static void main(String a[]){
  10.  
  11. String[] str = {"www.easytutorial.in", "easytutorial.in"};
  12. for(int i=0;i < str.length;i++){
  13. if(str[i].matches("^www\\.(.+)")){
  14. System.out.println(str[i]+" Starts with 'www'");
  15. } else {
  16. System.out.println(str[i]+" is not starts with 'www'");
  17. }
  18. }
  19. }
  20. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
www.easytutorial.in Starts with 'www'
easytutorial.in is not starts with 'www'