Package org.opencms.gwt.client.ui.input
Class CmsRegexValidator
java.lang.Object
org.opencms.gwt.client.ui.input.CmsRegexValidator
- All Implemented Interfaces:
I_CmsValidator
Basic regular expression validator for widgets of field type string.
- Since:
- 8.0.0
-
Constructor Summary
ConstructorDescriptionCmsRegexValidator
(String regex, String message, boolean alwaysAllowEmpty) Creates a new regex-based validator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
validate
(I_CmsFormField field, I_CmsValidationController controller) If this method is called, the object should either validate the form field and report the result to the validation controller, or request asynchronous validation of the field from the validation controller.
-
Constructor Details
-
CmsRegexValidator
Creates a new regex-based validator. The regular expression passed as a parameter is used to match complete strings, not parts of strings. For example, a regex of "AAA" will only match the string "AAA", and not "BAAA". If the regex starts with an exclamation mark ("!"), the match will be inverted, i.e. only strings that don't match the rest of the regular expression will be interpreted as valid.- Parameters:
regex
- a regular expressionmessage
- an error messagealwaysAllowEmpty
- if true, the validation will always allow the empty string
-
-
Method Details
-
validate
Description copied from interface:I_CmsValidator
If this method is called, the object should either validate the form field and report the result to the validation controller, or request asynchronous validation of the field from the validation controller.- Specified by:
validate
in interfaceI_CmsValidator
- Parameters:
field
- the form field to be validatedcontroller
- the validation controller- See Also:
-