Modifier and Type | Method and Description |
---|---|
static RegexValidator |
forAlphaNumeric(String errorMessage)
Creates a RegexValidator for alphanumeric inputs.
|
static RegexValidator |
forEmail(String errorMessage)
Creates a RegexValidator for email addresses.
|
static RegexValidator |
forPattern(String pattern,
String errorMessage)
Creates a RegexValidator with a custom pattern.
|
static RegexValidator |
forURL(String errorMessage)
Creates a RegexValidator for URLs.
|
ValidationResult |
validate(String input) |
public static RegexValidator forPattern(String pattern, String errorMessage)
pattern
- The pattern to use for the validation. Must be a valid
RegEx.errorMessage
- The error message that is returned if the validation fails.PatternSyntaxException
- Thrown if the given pattern is not a valid RegEx.public static RegexValidator forEmail(String errorMessage)
errorMessage
- The error message that is returned if the validation fails.PatternSyntaxException
- Thrown if the given pattern is not a valid RegEx.public static RegexValidator forURL(String errorMessage)
errorMessage
- The error message that is returned if the validation fails.PatternSyntaxException
- Thrown if the given pattern is not a valid RegEx.public static RegexValidator forAlphaNumeric(String errorMessage)
errorMessage
- The error message that is returned if the validation fails.PatternSyntaxException
- Thrown if the given pattern is not a valid RegEx.public ValidationResult validate(String input)
Copyright © 2017. All rights reserved.