PageRenderTime 116ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/app/src/main/java/Utility/Validator.java

https://gitlab.com/arifhasnat/ajkerdeal
Java | 24 lines | 17 code | 4 blank | 3 comment | 0 complexity | 0e9735963b13afe003595e3277740298 MD5 | raw file
  1. package Utility;
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4. /**
  5. * Created by haider_kazal on 12/19/15.
  6. */
  7. public class Validator {
  8. public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
  9. Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
  10. public static final Pattern VALID_MOBILE_NUMBER_REGEX =
  11. Pattern.compile("", Pattern.CASE_INSENSITIVE);
  12. public static boolean isValidEmail(String email) {
  13. Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(email);
  14. return matcher.find();
  15. }
  16. public static boolean isValidMobileNumber(String mobileNumber) {
  17. Matcher matcher = VALID_MOBILE_NUMBER_REGEX.matcher(mobileNumber);
  18. return matcher.find();
  19. }
  20. }