List of utility methods to do Email Validate
String | cleanUpEmailAddress(CharSequence address) Strip off some spurious characters that make it harder to dedup return ADDRESS_CLEANUP.matcher(address).replaceAll(""); |
boolean | containsEmail(String chunk) If the chunk looks like it contains an email if (chunk == null) { return false; if (EMAIL.matcher(chunk).find()) { return true; return false; |
String | extractEmail(String string, StringBuffer sb) extract Email Matcher emailMatcher = EMAIL.matcher(string); String email = ""; while (emailMatcher.find()) { emailMatcher.appendReplacement(sb, ""); email = emailMatcher.group(1); emailMatcher.appendTail(sb); return email; ... |
Set | extractEmailAddresses(final String text) This method analyses a text for email addresses and returns a set of those found. final Set<String> addresses = new HashSet<String>(); final Pattern p = Pattern.compile(EMAIL_REG_EXP); final Matcher m = p.matcher(text); while (m.find()) { addresses.add(m.group(0)); return addresses; |
String | format(String emails) Parses the parameter for valid email addresses if (emails == null) return ""; StringBuilder target = new StringBuilder(); Pattern p = Pattern.compile("[,\\s|;]+"); String[] result = p.split(emails); for (int i = 0; i < result.length; i++) { if (!isEmailValid(result[i])) continue; ... |
String | getEmail(String author) Get email address of the author. Matcher emailMatcher = EMAIL_PATTERN.matcher(author); String email = author; if (emailMatcher.find()) { email = emailMatcher.group(1).trim(); return email; |
String | getEmailAddressFromDN(String dn) get Email Address From DN Pattern emailPattern = Pattern.compile("Email=([^/]*)"); Matcher m = emailPattern.matcher(dn); if (m.find()) { return m.group(1); return null; |
String | getEmailListStr(String tempStr) get Email List Str List<String> list = new ArrayList<String>(); String regex = "[^a-zA-Z-]To: (.+)"; Pattern ptn = Pattern.compile(regex); Matcher mc = null; mc = ptn.matcher(tempStr); String temp = null; System.out.println("\n\n------------------------------------"); while (mc.find()) { ... |
List | getEmails(String str) get Emails Matcher matcher = EMALE_PATTERN.matcher(str); List<String> list = null; String email = null; while (matcher.find()) { if (list == null) { list = new ArrayList<String>(); email = matcher.group(); ... |
String | getFirstEmailAddr(String s) Returns the first email address found in the given string or null if not found.
if (s == null) { return null; if (patternEmail == null) { patternEmail = Pattern.compile(REGEX_EMAIL); Matcher matcher = patternEmail.matcher(s); if (matcher.find()) { ... |