Data
Lengths and Patterns
You can restrict the data length for schema elements with the data type string, and you can use patterns to restrict the valid value sets.
Attributes of Schema Elements with the Data Type String
Attribute |
Description |
minLength |
Minimum number of characters (including spaces, punctuation, and special characters)
|
maxLength |
Maximum number of characters (including spaces, punctuation, and special characters)
|
Pattern |
Regular expression against which user unput is to be validated. A regular expression defines a pattern that describes a set of character strings. At validation the system checks whether the character string entered by the user matches this pattern.
|
If you select the data type String on the tab page Type, the system displays the attributes on the same tab page. Before you enter an attribute you have to select the corresponding checkbox.
Regular expressions are standard in the UNIX world and in programming languages such as Perl. For detailed information on regular expressions, see the specialist literature and the information on the Internet. The following examples are meant only to clarify regular expressions.
Examples of Regular Expressions
Expression |
Description |
^[1-6]$ |
A number between 1 and 6
|
^20([0][4-9]|[1][0-9])$ |
A year between 2004 and 2019
|
^(low|normal|high|very high)$ |
A simple value set (low or normal or high or very high) The system distinguishes between uppercase and lowercase. Note that the value set cannot be localized and is not supported by a combo box.
|
^[1-9][0-9]{5}$ |
Number consisting of 6 figures that cannot begin with 0.
|
^https?://.* |
The string must begin with http:// or https://
|
The characters ^ and $ at the beginning and end define that the character strings have to begin and end as specified. Validation does not accept entries that only contain the pattern as a partial string. If you omit the characters ^ and $ at the beginning and the end of the string, the system adds them.