[POO] created email validation method
This commit is contained in:
parent
5ffea8034e
commit
7c3793760f
|
@ -3,6 +3,10 @@ package utils;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Validations {
|
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) {
|
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue