Use regular expressions (RegEx) with a plugin
- Last UpdatedApr 24, 2025
- 2 minute read
When you employ a regular expression (RegEx) with a plugin, the validation process uses the FieldPlugIn element and a plugin defined in a RegEx file. You will need to set the following parameters:
-
Name="ValidationRegexField"
-
Args="<Regex defined in ADERegex files>"
The ADERegex files are located in either the %DNAInstallRoot%\ADE\config\ADE\Regex or %DNADataRoot%\ADE\config\ADE\Regex directory.
The FieldPlugIn element uses a RegEx defined in an XML file.
For example, the Number of Input Bits field on the Input tab of the status Row Edit dialog box uses the FieldPlugIn element to restrict the number of input bits defined for the status point. The StatusInputBit RegEx defined in the ADERegex.xml file indicates the valid input values are none, 0, 1, or 2:
<Regex Name="StatusInputBit" Expression="[012]?" Description="Enter 0, 1 or 2" />
The inbit.bitwi column adds StatusInputBit as the constraint:
<Field
Name="inbit_@bitwi"
RowLabel="Number of Input Bits"
.
.
DisplayWidthToUse="Minimum">
<FieldPlugIn Name="ValidationRegexField" Args="StatusInputBit" />
</Field>
The Args refers to the RegEx named StatusInputBit, which is defined in the ADERegex.xml file. The Expression attribute in the RegEx states that the valid input values are none, 0, 1, or 2. If the value entered is anything other than one of those four values, the system displays a warning. Hovering the mouse pointer over the warning displays the text (tooltip) contained in the RegEx's Description attribute.

When you correct the error, the system removes the icon and allows you to save the record.
The FieldPlugIn element is further discussed in Extend functionality using plugins.