FIELD_REGEX

MapPrep

FIELD_REGEX

 

Inserts a regular expression that can be used to constrain and validate user input to a field based on the repository definition of the field. The regular expression inserted depends on the type of field.

Usage

<FIELD_REGEX>

Examples

Nature of field

 

Regular Expression

Description

A4

 

 ^.{0,4}$

Allows between 0 and 4 characters.

A4, required field

 

 ^.{1,4}$

Allows between 1 and 4 characters.

D4, no negatives

 

 ^[+]?[0]*[0-9]{0,4}$

Allows an optional + sign, followed by any number of leading zeros, followed by up to four numeric digits.

 

D4, allows negatives

 

 ^[+-]?[0]*[0-9]{0,4}$

Allows an optional + or - sign, followed by any number of leading zeros, followed by up to four numeric digits.

 

D4.2, no negatives

 

 ^[+]?[0]*[0-9]{0,2}(\.[0-9]{0,2}[0]*)?$

Allows an optional + sign, followed by any number of leading zeros, followed by up to two numeric digits, followed by an optional decimal point. If a decimal point is found then up to two numeric digits may follow, followed by any number of trailing zeros.

 

D4.2, allows negatives

 

 ^[+-]?[0]*[0-9]{0,2}(\.[0-9]{0,2}[0]*)?$

Allows an optional + or - sign, followed by any number of leading zeros, followed by up to two numeric digits, followed by an optional decimal point. If a decimal point is found then up to two numeric digits may follow, followed by any number of trailing zeros.

 

I4, no negatives

 

 ^[+]?[0]*[0-9]{0,10}$

Allows an optional + sign, followed by any number of leading zeros, followed by up to ten numeric digits.

 

I4, allows negatives

 

 ^[+-]?[0]*[0-9]{0,10}$

Allows an optional + or - sign, followed by any number of leading zeros, followed by up to ten numeric digits.

 

In the table above, the numbers shown in red are based on the size of the field being processed at the time.

Restrictions

Integer Fields

The regular expression for integer fields will constrain the number of characters entered, and restrict those characters to being numeric characters, but it will NOT restrict the user to only entering valid numeric values. For example, an i1 field can store up to 127, the regular expression will constrain the entry to 3 numeric characters but it will still be possible to enter an out of range value (e.g. 256).

Required Fields

Currently CodeGen only takes a fields "required" status into account for alpha fields. If an alpha field is required then the regular expression produced will require at least one character be present.

Alternate forms

None

See also

Other field loop expansion tokens

 

 


Copyright © 2018  Synergex International, Inc.