Java tutorial
//package com.java2s; import android.util.Log; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String searchForPattern(String message, String pattern) { Pattern first = Pattern.compile(pattern); Matcher match = first.matcher(message); if (match.find()) { String str = match.group(0); Log.i("searchForPattern", str); return str; } Log.i("searchForPattern", "no match found"); return null; } }