rlike operator

Returns true if str matches regex.

Syntax

str [NOT] rlike regex

Arguments

  • str: A STRING expression to be matched.

  • regex: A STRING expression with a matching pattern.

Returns

A BOOLEAN.

The regex string must be a Java regular expression. String literals are unescaped. For example, to match '\abc', a regular expression for regex can be '^\\abc$'.

rlike is a synonym for regexp operator.

str NOT rlike ... is equivalent to NOT(str rlike ...).

Examples

> SELECT '%SystemDrive%\\Users\\John' rlike '%SystemDrive%\\\\Users.*';
true