Skip To Content

Filter using regular expressions

The MATCHES operator—available when configuring an attribute filter—supports the use of regular expressions to find a pattern within a target field. Regular expression pattern matching can be a powerful tool for data validation. The full scope and syntax of regular expressions cannot be covered here, but the examples below help illustrate their use in filters.

Hinweis:

Regular expressions can only be applied to attribute fields of type string.

Hinweis:

The specified pattern is matched against the entire string. You cannot enter California to match strings that contain that substring. Specifying a pattern .*California.* accounts for zero or more characters both before and after the substring the filter is supposed to find.

Field valueRegEx patternResult

SWA2382

^SWA[0-9]+$

The carat sign (^) anchors the pattern to the beginning of the string, and a dollar sign ($) anchors the pattern to the end of the string. The [0-9]+ portion of the pattern specifies that one or more digits 0 through 9 should be found at the end of the string.

Any values in the target field that do not begin with SWA, followed by some number of digits representing a flight number, will be discarded by the filter.

02/15/1973

[0-1][0-9][/][0-3][0-9][/][0-1][0-9][0-9][0-9]

The use of numeric ranges such as 0 through 1, 0 through 3, and 0 through 9 specifies the expected values for a mm/dd/yy date string. Values that do not have a two-digit month followed by a two-digit day and a four-digit year, separated by a slash (/), will be discarded by the filter.

3.14159

^[-+]?[0-9]*\.?[0-9]+$

This pattern verifies that the string in the target field can be interpreted as a numeric value. An asterisk (*) in the RegEx pattern matches zero or more instances of the preceding character; a question mark (?) matches zero or one instances. The backslash means that the period (.) is a literal decimal point, not a wildcard (*). The pattern makes a plus (+) or minus (-) sign the integer portion of a floating point value and the literal decimal optional (may occur zero times).

Regular expression examples