Here you can find the source of validEmailAddrWithDataExact(String str)
Parameter | Description |
---|---|
str | a parameter |
public static boolean validEmailAddrWithDataExact(String str)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /** Matching exact 'jack@abc.com{Jack}{Mr.}' */ private static final String REGEX_EMAIL_WITH_DATA_EXACT = "^[\\w\\.%\\+-]+@[\\w\\.%\\+-]+\\.[A-Za-z]+(\\{[^\\}\\n]*\\})*$"; /** Matching exact 'jack@abc.com{Jack}{Mr.}' */ private static Pattern patternEmailWithDataExact = null; /**//w w w . j ava 2 s . c o m * Validate the given string is exact of 'a@b.com{Mr.}{A}'. * @param str * @return */ public static boolean validEmailAddrWithDataExact(String str) { if (str == null) { return false; } if (patternEmailWithDataExact == null) { patternEmailWithDataExact = Pattern.compile(REGEX_EMAIL_WITH_DATA_EXACT); } Matcher matcher = patternEmailWithDataExact.matcher(str); return matcher.find(); } }