This question already has an answer here:
What is the (\\1) in this case? And how does the method "group" work with it?
public class Test{
public static void main(String[] args){
Pattern p = Pattern.compile("(something).+(\\1)");
Matcher m = p.matcher("lol asd adlso something ALALALALA something boba" );
if(m.find())
System.out.println(m.group());
}
}
Aucun commentaire:
Enregistrer un commentaire