Java examples for Regular Expressions:Match
Match string with 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(".at"); Matcher m = p.matcher(jaText); while (m.find()) { System.out.printf("%s\n", m.group()); }// ww w .j av a2s . co m } }