Java tutorial
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { String regex = "[a-z]@."; Pattern p = Pattern.compile(regex); String str = "abc@yahoo.com,123@cnn.com,abc@google.com"; Matcher m = p.matcher(str); if (m.find()) { String foundStr = m.group(); System.out.println("Found text is:" + foundStr); } } }