Home > Guides > Core Developers Guide > Validation > regex validator

Description

Validates a string field using a regular expression.

Parameters

  • fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
  • regexp - The RegExp expression
  • caseSensitive - Boolean (Optional). Sets whether the expression should be matched against in a case-sensitive way. Default is true.
  • trim - Boolean (Optional). Sets whether the expression should be trimmed before matching. Default is true.
  • regexExpression - String (Optional). Defines regExp expression as an OGNL expression - will be evaluated to String
  • caseSensitiveExpression - String (Optional). Defines caseSensitive param as an OGNL expression - will be evaluated to Boolean.
  • trimExpression - String (Optional). Defines trim param as an OGNL expression - will be evaluated to Boolean

You can mix normal params with expression aware params but thus was not tested

Warning

Do not use ${regexExpression}, ${caseSensitiveExpression} and ${trimExpression} as an expression as this will turn into infinitive loop!

Examples