Created
November 16, 2019 13:31
-
-
Save AndSky90/a2b929154f820cda0574206d81fc7d52 to your computer and use it in GitHub Desktop.
Validator types regex patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**перечисление типов валидатора текста*/ | |
enum class ValidatorType( | |
val regex: Pattern | |
) { | |
VALIDATE_NAME(Pattern.compile("^[а-яА-ЯёЁa-zA-Z_ -]+$")), | |
VALIDATE_EMAIL(Patterns.EMAIL_ADDRESS), | |
VALIDATE_WEB_URL(Patterns.WEB_URL), | |
VALIDATE_POSITION(Pattern.compile("^[а-яА-ЯёЁa-z0-9A-Z_ -]*$")), | |
ANY(Pattern.compile(".*")), | |
VALIDATE_DATE(Pattern.compile("^(0?[1-9]|[12][0-9]|3[01])[.](0?[1-9]|1[012])[.]\\d{4}\$")), | |
VALIDATE_ARABIC_NUMBER(Pattern.compile("^[0-9]+$")), | |
VALIDATE_PHONE_NUMBER(Pattern.compile("^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*\$")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment