Source Code : Matcher match
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Matcher match

import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MatcherMatchesExample {
public static void main(String args[]) {
Pattern p = Pattern.compile("J2SE");
String candidateString_1 = "j2se";
String candidateString_2 = "J2SE ";
String candidateString_3 = "J2SE2s";
Matcher matcher_1 = p.matcher(candidateString_1);
Matcher matcher_2 = p.matcher(candidateString_2);
Matcher matcher_3 = p.matcher(candidateString_3);
String msg = ":" + candidateString_1 + ": matches?: ";
System.out.println(msg + matcher_1.matches());
msg = ":" + candidateString_2 + ": matches?: ";
System.out.println(msg + matcher_2.matches());
msg = ":" + candidateString_3 + ": matches?: ";
System.out.println(msg + matcher_3.matches());
}
}
Thank with us