Validate Text
Verb: validateText
Available from: <Standard>
Validates whether a text is in the correct format for the validation type chosen.
Syntax
validateText --text(String) --texttype(TextValidationType) (Boolean)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--text | Text | Required | Text | Text to be validated. |
--texttype | Type | Required | TextValidationType | Type of validation applied to Text. Options:
|
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Result | Boolean | Validation Result: "True" if Text is in the correct format, or "False" if it is not. |
Example
Example 1: Validates whether a text is in the format of a valid credit card number.
defVar --name textToValidate --type String --value 4556908400325886
defVar --name validationResult --type Boolean
validateText --text "${textToValidate}" --texttype "CreditCard" validationResult=value
logMessage --message "${validationResult}" --type "Info"
// The example returns the following output: true
Example 2: Validates whether a text is in the format of a valid Email.
defVar --name textToValidate --type String --value "useruser.com"
defVar --name validationResult --type Boolean
validateText --text "${textToValidate}" --texttype "Email" validationResult=value
logMessage --message "${validationResult}" --type "Info"
// The example returns the following output: false