REGEXP_LIKE
Syntax
REGEXP_LIKE(expr, pat[, match_type])
Description
REGEXP_LIKE returns 1 if the string expr matches the pattern specified by the regular expression pat, and 0 otherwise. If expr or pat is NULL, it returns NULL.
The match_type parameter specifies the matching mode. Valid values are:
-
c: case-sensitive matching. -
i: case-insensitive matching. -
mmakes^and$match the start and end of each line. -
nmakes.match line endings as well as other characters. -
uuses only LF (\n) as a line ending. By default, the engine uses CRLF-aware matching.
Regular expression behavior in V1.4.1
Seekdb uses the fancy-regex engine for REGEXP and the REGEXP_* functions. Before upgrading from V1.4.0, test patterns that depend on ICU syntax, Unicode case folding, character classes, or line boundaries. For example, the previous engine's grapheme escape \X is unavailable.
| Global system variable | Default SQL value | Effective limit |
|---|---|---|
regexp_time_limit | 32 | The specified value multiplied by 10,000 backtracking attempts, up to 100,000,000 attempts. 0 selects 1,000,000 attempts. |
regexp_stack_limit | 8000000 | The byte budget for the compiled regex and for each delegated DFA, up to 64 MiB. 0 selects 8 MiB. |
Examples
SELECT REGEXP_LIKE('OceanBase', 'OCEANBASE');
+---------------------------------------+
| REGEXP_LIKE('OceanBase', 'OCEANBASE') |
+---------------------------------------+
| 1 |
+---------------------------------------+
1 row in set (0.001 sec)
SELECT REGEXP_LIKE('OceanBase', 'OCEANBASE','c');
+-------------------------------------------+
| REGEXP_LIKE('OceanBase', 'OCEANBASE','c') |
+-------------------------------------------+
| 0 |
+-------------------------------------------+
1 row in set (0.001 sec)
SELECT REGEXP_LIKE('Ocean\nBase', 'OCEAN.BASE');
+------------------------------------------+
| REGEXP_LIKE('Ocean\nBase', 'OCEAN.BASE') |
+------------------------------------------+
| 0 |
+------------------------------------------+
1 row in set (0.000 sec)
SELECT REGEXP_LIKE('Ocean\nBase', 'OCEAN.BASE','n');
+----------------------------------------------+
| REGEXP_LIKE('Ocean\nBase', 'OCEAN.BASE','n') |
+----------------------------------------------+
| 1 |
+----------------------------------------------+
1 row in set (0.000 sec)