Regular expression
See also: Regular expression (Validator)
The Behaviour type Regular expression checks the value of the element to be evaluated against the expression stored in the Regular expression parameter.
If no element is linked, the executing element is evaluated.
If an element is linked , then this linked element is evaluated.
The check result determines which actions are executed:
If the return value of the element to be evaluated matches the Regular expression, the Actions on 'true' are executed.
If the check fails, the Actions on 'false' are executed.
►NOTE◄ In both cases, any behaviour data is passed as $input to the actions and not the checked value of the evaluated element.
By clicking on the play symbol (►) to the right of the regular expression input field, a test window can be displayed. In the test window, a possibly extensive Test text can be entered or inserted. The Test text is permanently checked against the Regular expression entered above, which can also be edited.
The part of the text to which the current expression applies is highlighted with green shading.
Only if the entire test text entered matches the expression entered will the
symbol appear in the text input field on the right (top right image).
Check is case sensitive (Standard; the '/' characters may be omitted here) |
Check is not case-sensitive |
|
|
►IMPORTANT◄ The Behaviour type Regular expression executes the Actions on 'true' in both cases, if the element to be evaluated returns a text value as in the example (abcXYZ). It is important that in both cases all the criteria of the regular expression are met, not whether the entire text corresponds to the expression. To ensure that the check is only passed if a string contains just lower case letters, the following expression would have to be used:
Example
A Text field in a Repeatable element should be checked with Changed to see if the string it contains matches a regular expression that is used in the example to determine the plausibility of the input as an Aircraft type according to the US armed forces classification. A one or two-digit combination of certain capital letters followed by a minus sign and a maximum three-digit type number (>0) is considered plausible.
Next to the input field, each line should optionally contain one of two Button elements with an icon representing the check result:
If the input is plausible, a Button with a check symbol should appear.
If the input is doubtful, a Button with a question mark symbol should appear.
Runtime example:
Configuration:
|
The Text field in the Repeatable element container is configured for the behaviour shown on the left:
|