I have seen a lot of useful links in this site about regular expression, I used it to create the following regular expression for the command but it won't work:
if(input.matches("find -[0-9]+ A www.(.*).(.*)")){
System.out.println("m=" +input);
}
else{System.out.println("m=" +input);}
but it didn't work, what did I do wrong?
Note:
- find -2 A www.google.com should be accepted
- find -2 A www.facebook.com should be accepted
- find -A A www.facebook.com shouldn't be accepted
- find -2 B www.facebook.com shouldn't be accepted
"^find -[0-9]+ A www\\.([^.]+)\\.(.+)$"
find -[0-9]+ A www.(.*)
I think the format will suit you better. Example