[POO] created email validation method

This commit is contained in:
TiagoRG 2023-04-18 09:58:07 +01:00
parent 1388852f3c
commit 679a6406e0
Signed by untrusted user who does not match committer: TiagoRG
GPG Key ID: DFCD48E3F420DB42
1 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,10 @@ package utils;
import java.util.regex.Pattern;
public class Validations {
public static boolean validateEmail(String email) {
return Pattern.matches("^[a-zA-Z0-9._]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$", email);
}
public static boolean validateVehiclePlate(String plate) {
return Pattern.matches("^[A-Z]{2}-\\d{2}-\\d{2}|\\d{2}-[A-Z]{2}-\\d{2}|\\d{2}-\\d{2}-[A-Z]{2}|[A-Z]{2}-\\d{2}-[A-Z]{2}|[A-Z]{2}-[A-Z]{2}-\\d{2}|\\d{2}-[A-Z]{2}-[A-Z]{2}$", plate);
}