RegExp

XML Forms Guide

Version
R2024.2.1
RegExp

The <RegExp> tag allows you to perform regular expression validation on a string field in an <EPGridColumn> tag within an <EmployeePropertyGrid> tag before a form is submitted.

<RegExp> defines the regular expression that controls what you can enter into the field. For example, ^[0-9]*$ restricts the field to numbers only. ^[A-Z]*$ allows only uppercase letters.

The incorrect value is flagged directly on the field, with an error pop-up that you can customize using the associated tag <RegExpErrorMessage>.

The following sample restricts a field to five lowercase letters, and outputs a custom message:

Copy
<EPGridColumn>
    <BindingProperty>Value</BindingProperty>
    <XRefCode>EmployeePropertyXrefCode21</XRefCode>
    <IsRequired>True</IsRequired>
    <TextAlignment>Right</TextAlignment>
    <DefaultValue>az05</DefaultValue>
    <RegExp>^[a-z]{0,5}$</RegExp>
    <RegExpErrorMessage>Only up to 5 lowercase letters are allowed</RegExpErrorMessage>
</EPGridColumn>