RegexValidator is a {@link javax.faces.validator.Validator}that checks the value of the corresponding component against specified pattern using Java regular expression syntax. The regular expression syntax accepted by the RegexValidator class is same as mentioned in class {@link java.util.regex.Pattern} in packagejava.util.regex
.
The following algorithm is implemented:
null
, exit immediately.null
or an empty String, throw a {@link javax.faces.validator.ValidatorException}with a {@link #PATTERN_NOT_SET_MESSAGE_ID} message.pattern
property has been configured on this {@link javax.faces.validator.Validator}, check the passed value against this pattern. If value does not match pattern throw a {@link ValidatorException}containing a {@link #NOT_MATCHED_MESSAGE_ID} message.Construct the validator either for a single regular expression or a set (array) of regular expressions. By default validation is case sensitive but constructors are provided to allow case in-sensitive validation. For example to create a validator which does case in-sensitive validation for a set of regular expressions:
String[] regexs = new String[] {...}; RegexValidator validator = new RegexValidator(regexs, false);
true
or false
:boolean valid = validator.isValid(value);
String result = validator.validate(value);
String[] result = validator.match(value);
Cached instances pre-compile and re-use {@link Pattern}(s) - which according to the {@link Pattern} API are safe to use in a multi-threaded environment. @version $Revision: 1227719 $ $Date: 2012-01-05 17:45:51 +0000 (Thu, 05 Jan 2012) $ @since Validator 1.4
Regex validator.
@author Rick HightowerConstruct the validator either for a single regular expression or a set (array) of regular expressions. By default validation is case sensitive but constructors are provided to allow case in-sensitive validation. For example to create a validator which does case in-sensitive validation for a set of regular expressions:
String[] regexs = new String[] {...}; RegexValidator validator = new RegexValidator(regexs, false);
true
or false
:boolean valid = validator.isValid(value);
String result = validator.validate(value);
String[] result = validator.match(value);
Cached instances pre-compile and re-use {@link Pattern}(s) - which according to the {@link Pattern} API are safe to use in a multi-threaded environment. @since Validator 1.4
validateNull
:
|
|
|
|
|
|
|
|
|
|
|
|
|
|