All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zw.co.paynow.validators.EmailValidator Maven / Gradle / Ivy

Go to download

This project contains libraries to interface with Zimbabwe's Leading Payments Gateway, Paynow REST API.

The newest version!
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