I want to find all words of length 3, starting with "l" and ending with "f". Here is my code:
Pattern pt = Pattern.compile("\\bl.+?f{3}\\b");
Matcher mt = pt.matcher("#Java life! Go ahead Java,lyf,fly,luf,loof");
while(mt.find()) {
System.out.println(mt.group());
}
It does not show anything. tried it also, Pattern pt = Pattern.compile("l.+?f{3}");
o / p was still not expected.
The o / p value should be:
lyf luf
source
share