# **REGEXP_LIKE()**

## **Function Description**

`REGEXP_LIKE()` is used to determine whether the specified string matches the provided regular expression pattern. If the string conforms to the pattern, the function returns `TRUE`, otherwise `FALSE`. It works similar to the `REGEXP` operator, but it can accept a third optional parameter `match_type`, which defines the matching behavior.

REGEXP and RLIKE are synonyms for `REGEXP_LIKE()`.

## **grammar**

```text
> REGEXP_LIKE(expr, pat[, match_type])
```

## Parameter definition

- `expr` is the string to search for.

- `pat` is the regular expression to look for in a string.

- The `match_type` parameter is an optional string that specifies the way to match. This parameter can be composed of the following characters, each character specifies a matching method, and the order of characters does not affect the result:

    + `'c': case sensitive for matching (i.e. uppercase and lowercase letters are treated as different characters). By default, matches are case sensitive.
    + `'i'`: matches insensitively (i.e. uppercase and lowercase letters are treated as the same characters).
    + `'n'`: Allows the `.` symbol to match newlines. By default, the `.` symbol does not match newlines.
    + `'m': Treat a string as multiple lines. That is,`^` matches the beginning of the string or the beginning of any line, and `$` matches the end of the string or the end of any line. By default, `^` only matches the beginning of the string, and `$` only matches the end of the string.
    + `'u': Treats the pattern as a UTF-8 string. By default, the pattern is treated as a byte string.

## **Example**

```text
mysql> SELECT REGEXP_LIKE('CamelCase', 'CAMELCASE');
+------------------------------------------+
| regexp_like(CamelCase, CAMELCASE) |
+------------------------------------------+
| false |
+------------------------------------------+
1 row in set (0.01 sec)

mysql> SELECT REGEXP_LIKE('CamelCase', 'CAMELCASE', 'i');
+---------------------------------------------+
| regexp_like(CamelCase, CAMELCASE, i) |
+---------------------------------------------+
| true |
+---------------------------------------------+
1 row in set (0.01 sec)
```
