
zw.co.paynow.validators.EmailValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
This project contains libraries to interface with Zimbabwe's Leading Payments Gateway, Paynow REST API.
package zw.co.paynow.validators;
import java.util.regex.Pattern;
public class EmailValidator {
/**
* Validate an email string
*
* @param email The string to validate as an email
* @return Whether the string is a valid email i.e. true if valid
*/
public static boolean validateEmail(String email) {
return Pattern.compile(
"^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"
)
.matcher(email).matches();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy