IsRegEx - script and chart function
IsRegEx() returns whether the specified text is a valid regular expression.
This function performs regex operations that are case-sensitive. You can alternatively use the variant IsRegExI() to perform case-insensitive regex operations.
Syntax:
IsRegEx (expr [, debug])
Return data type: dual
Argument | Description |
---|---|
expr | String expression containing the regular expression to evaluate. |
debug | Optional argument. If any value is specified for this argument, the expression returns a text hint outlining how an invalid regular expression might be fixed. |
Example | Result |
---|---|
IsRegEx('[a-z]') | Returns -1 (true). |
IsRegEx(']0-1[', 1) | This example returns an error message with a hint to correct the invalid regular expression ]0-1[. |
IsRegEx('[a-z') | Returns 0 (false). No error message is shown because the debug argument is not specified. |
When to use it
You can use IsRegEx() to test whether the regular expressions you write are valid in Qlik Sense. Foe example, you can load a table into your app with input text and an evaluation of the text's validity as regex.