Class CmsRegexValidator

java.lang.Object
org.opencms.gwt.client.ui.input.CmsRegexValidator
All Implemented Interfaces:
I_CmsValidator

public class CmsRegexValidator extends Object implements I_CmsValidator
Basic regular expression validator for widgets of field type string.

Since:
8.0.0
  • Constructor Details

    • CmsRegexValidator

      public CmsRegexValidator(String regex, String message, boolean alwaysAllowEmpty)
      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 expression
      message - an error message
      alwaysAllowEmpty - if true, the validation will always allow the empty string
  • Method Details