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

# Regular Expressions

> Match text against regular expressions in Bunny Database with the REGEXP operator and the regexp and regexpi functions.

Bunny Database includes the SQLite [regexp extension](https://www.sqlite.org/src/file/ext/misc/regexp.c).

| Function | What it does |
| - | - |
| `regexp(pattern, text)`, `text REGEXP pattern` | Case-sensitive match. Returns 1 for a match and 0 otherwise. |
| `regexpi(pattern, text)` | Case-insensitive match. |

```sql theme={null}
SELECT regexp('^a.c$', 'abc');   -- 1
SELECT 'ABC' REGEXP '^a';        -- 0
SELECT regexpi('^a', 'ABC');     -- 1

SELECT email FROM users WHERE email REGEXP '@example\.com$';
```

## Pattern syntax

The pattern syntax is SQLite's own regular expression dialect, a POSIX-like subset described in the header comment of the [regexp extension source](https://www.sqlite.org/src/file/ext/misc/regexp.c).

It supports `\d`, `\w`, `\s`, `\b`, `{n,m}` repetition, alternation, and Unicode text. Back-references such as `\1` are not supported and raise an error.

A `NULL` argument returns `NULL`, and an invalid pattern is an error.


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