You can use regular expressions to match strings inside metric queries. You can use regex101.com to generate regular expressions, but not all datasources handle meta sequences the same. For example, if your expression contains the sequence \d (to match any digit), the datasource may require that you add a backslash in front of the sequence for it to work in a SELECT statement: to get \d, you enter \\d.
When you create a conformity metric, you must add at least one condition to check rows for conformity. If you choose Does not match regex or Match regex, the pattern you enter for comparisons becomes a single-quote delimited string in the metric query. Because you cannot change the string delimiters, this can cause SQL errors when your pattern contains meta sequences, depending on the datasource.
You can use regular expressions in your SQL metrics as needed, but meta sequences might cause SQL errors depending on how you use them and the metric's datasource. In some cases, you can use specific string delimiters to avoid these errors. Otherwise, you can add escape characters in front of any meta sequences.
Before you use a regular expression in a metric, consider referring to the official support content for the metric's datasource, in particular content using regular expressions in SELECT statements.
Updated about 1 month ago