RLIKE
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Operators for MariaDB Xpand
Topics on this page:
Overview
See REGEXP.
USAGE
check RLIKE match
Value Name | Description |
---|---|
| The string to search |
| The regular expression match string |
EXAMPLES
SELECT 'This is a test' RLIKE 't.sts?' AS result1,
'3' RLIKE 3 AS result2;
+---------+---------+
| result1 | result2 |
+---------+---------+
| 1 | 1 |
+---------+---------+
SELECT 'Hello there' RLIKE '^e';
+--------------------------+
| 'Hello there' RLIKE '^e' |
+--------------------------+
| 0 |
+--------------------------+
CREATE TABLE rlike_example (
description VARCHAR(20),
example INT
);
INSERT INTO rlike_example VALUES
('Everything', 42),
('Dalmations', 101),
('Agent', 99),
('B. Doz.', 13),
('CPU', 64);
SELECT *
FROM rlike_example
WHERE description RLIKE 'ing$|^....t';
+-------------+---------+
| description | example |
+-------------+---------+
| Everything | 42 |
| Agent | 99 |
+-------------+---------+
-- Note that a backslash needs to be doubled due to string escaping
SELECT *
FROM rlike_example
WHERE description REGEXP '\\.';
+-------------+---------+
| description | example |
+-------------+---------+
| B. Doz. | 13 |
+-------------+---------+