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

# Regex Patterns

> Tokenizes text using a regular expression

The `regex_pattern` tokenizer tokenizes text using a regular expression. The regular expression can be specified with the pattern parameter.
For instance, the following tokenizer creates tokens only for words starting with the letter `h`:

```sql theme={null}
CREATE INDEX search_idx ON mock_items
USING paradedb (id, (description::pdb.regex_pattern('(?i)\bh\w*')))
WITH (key_field='id');
```

The regex tokenizer uses the Rust [regex](https://docs.rs/regex/latest/regex/) crate, which supports all regex constructs with the following
exceptions:

1. Look-around assertions such as `(?=...)`
2. Backreferences such as `\1`

Unlike [regex queries](/docs/reference/full-text/regex), which match against the index's term dictionary, the tokenizer runs over the
source text directly, so constructs like word boundaries (`\b`) and lazy quantifiers (`+?`) are supported, as the examples on this page show.

To get a feel for this tokenizer, run the following command and replace the text with your own:

```sql theme={null}
SELECT 'Hello world!'::pdb.regex_pattern('(?i)\bh\w*')::text[];
```

```ini Expected Response theme={null}
  text
---------
 {hello}
(1 row)
```
