> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# regexp

> Checks whether a given expression matches the regular expression specified by pattern.

Checks whether a given expression matches the regular expression specified by `pattern`. If yes, 1 is returned. Otherwise, 0 is returned. NULL is returned if any of the input parameter is NULL.

regexp() supports more complex matching conditions than [like()](/documents/4.2/sql-reference/sql-functions/like-predicate-functions/like.md).

## Syntax

```Haskell theme={null}
BOOLEAN regexp(VARCHAR expr, VARCHAR pattern);
```

## Parameters

* `expr`: the string expression. The supported data type is VARCHAR.

* `pattern`: the pattern to match. The supported data type is VARCHAR.

## Return value

Returns a BOOLEAN value.

## Examples

```Plain Text theme={null}
mysql> select regexp("abc123","abc*");
+--------------------------+
| regexp('abc123', 'abc*') |
+--------------------------+
|                        1 |
+--------------------------+
1 row in set (0.06 sec)

select regexp("abc123","xyz*");
+--------------------------+
| regexp('abc123', 'xyz*') |
+--------------------------+
|                        0 |
+--------------------------+
```

## Keywords

regexp, regular


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.