Java Email Validate getSafeMailAddr(String mailAddr)

Here you can find the source of getSafeMailAddr(String mailAddr)

Description

get Safe Mail Addr

License

Open Source License

Declaration

public static String getSafeMailAddr(String mailAddr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String getSafeMailAddr(String mailAddr) {
        Pattern reg = Pattern.compile("[\\w_]+@[\\w_]+\\.[A-Za-z]{2,4}");
        Matcher exec = reg.matcher(mailAddr);
        if (exec.find()) {
            return exec.group(0);
        }//w w w .  j a v  a  2 s . co  m
        return mailAddr;
    }
}

Related

  1. getEmail(String author)
  2. getEmailAddressFromDN(String dn)
  3. getEmailListStr(String tempStr)
  4. getEmails(String str)
  5. getFirstEmailAddr(String s)
  6. getSmtpPort(String email)
  7. isEmail(CharSequence email)
  8. isEmail(CharSequence input)
  9. isEmail(final String email)