import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class D{
public static void main(String[] args){
String strin="Do you want me i want you my name is love you";
Pattern p1=Pattern.compile("\\b[a-zA-Z]{2}\\b");
Matcher m1=p1.matcher(strin);
while(m1.find()){
System.out.print(m1.group()+" ");
}
}
} |
|