This question already has an answer here:
- method matches not work well 3 answers
I am trying to check different expression through java.util.regex.Pattern but It doesn't work well.
The next code return "no" but in my opinion must be return "yes". What is the problem?
if (Pattern.compile("historic").matcher("ahistoricbuilding").matches()) {
System.out.println("yes");
} else {
System.out.println("no");
}
Thanks.
Aucun commentaire:
Enregistrer un commentaire