POSIX Operators
Pattern-matching conditions
Last updated
Pattern-matching conditions
Last updated
A POSIX regular expression is a sequence of characters that specifies a match pattern. A string matches a regular expression if it is a member of the regular set described by the regular expression. POSIX regular expression patterns can match any portion of a string. ().
This grammar is partially supported in . POSIX Operators are transformed to in Snowflake.
POSIX pattern matching supports the following metacharacters (all the cases are supported in Snowflake):
.
Matches any single character.
*
Matches zero or more occurrences.
+
Matches one or more occurrences.
?
Matches zero or one occurrence.
|
Specifies alternative matches.
^
Matches the beginning-of-line character.
$
Matches the end-of-line character.
$
Matches the end of the string.
[ ]
Brackets specify a matching list, that should match one expression in the list.
( )
Parentheses group items into a single logical item.
{m}
Repeat the previous item exactly m times.
{m,}
Repeat the previous item m or more times.
{m,n}
Repeat the previous item at least m and not more than n times.
[: :]
Matches any character within a POSIX character class. In the following character classes, Amazon Redshift supports only ASCII characters, just like Snowflake: [:alnum:]
, [:alpha:]
, [:lower:]
, [:upper:]
Output Code:
Output Code:
Output Code:
Output Code:
Output Code:
Arguments with COLLATE specifications are not currently supported in the RLIKE function. As a result, the COLLATE clause must be disabled to use this function. However, this may lead to differences in the results.
Output Code:
If you require equivalence for these scenarios, you can manually add the following parameters to the function to achieve functional equivalence:
Parameter
Description
c
Case-sensitive matching
i
Case-insensitive matching
Arguments with COLLATE specifications are not currently supported in the REGEXP_COUNT function.
The parameters 'm' (enables multiline mode) and 's' (allows the POSIX wildcard character .
to match new lines) are used to achieve full equivalence in Snowflake. For more information please refer to .
The behavior of fixed char types may differ. Click for more information.
: The use of the COLLATE column constraint has been disabled for this pattern-matching condition.