The validation code syntax is recursively defined as:
<validation code> -> { [NOT](<validation code>) | <validation code> { AND | OR} <validation code> | <literal> { > | < | = | >= | <= | LIKE } <literal> } <literal> -> { value | <numeric literal> | '<string literal>' }
- Parentheses are evaluated first
- AND is evaluated before OR
- The left side of the expression is evaluated before the right side
- All operators are left-to right associative
- The LIKE operator assumes the right side of the expression is a string literal using SQL LIKE syntax, i.e. % is a wildcard. Note that, for any other operator, % in a string literal has no special meaning.
- value represents the result of the profiling metric being validated
- Numeric literals may be positive or negative with negative values preceded by a minus sign (e.g. -25), and may include a fractional part separated by a decimal point, e.g. 123.45
- String literals must be delimited by single quotes ('). If the string contains single quotes they may be escaped by using two single quotes, e.g. 'John''s email address'
- All operators may be used with both numeric and string literals, with the exception of LIKE which may only be used with strings.
Examples:
(value < 25 OR value > 35) AND NOT(value <= 0)
(matches all values less than 25 or greater than 35 but not values less than or equal to 0)value LIKE 'www.%.com' OR value LIKE 'www.%.net'
(matches all values that start with www. and end with .com or start with www. and end with .net, i.e. .com and .net websites)value = 'John''s email address'
(matches the value John's email address)-11 < value AND value < 25.5
(matches all values between -11 and 25.5)