Java examples for Regular Expressions:Match
Find match by using regular expression
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private String jaText = "this is a test "; public Main() { Pattern p = Pattern.compile("japanese letter"); Matcher m = p.matcher(jaText); if (m.find()) { System.out.println(m.group()); }//from w w w. j ava2s. c o m } }