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

# regexp_replace

> Replaces substrings matching a regular expression pattern with a replacement string.

This function uses repl to replace a sequence of characters in str that matches a regular expression pattern.

## Syntax

```Haskell theme={null}
VARCHAR regexp_replace(VARCHAR str, VARCHAR pattern, VARCHAR repl)
```

## Examples

```Plain Text theme={null}
MySQL > SELECT regexp_replace('a b c', " ", "-");
+-----------------------------------+
| regexp_replace('a b c', ' ', '-') |
+-----------------------------------+
| a-b-c                             |
+-----------------------------------+

MySQL > SELECT regexp_replace('a b c','(b)','<\\1>');
+----------------------------------------+
| regexp_replace('a b c', '(b)', '<\1>') |
+----------------------------------------+
| a <b> c                                |
+----------------------------------------+
```

## keyword

REGEXP\_REPLACE,REGEXP,REPLACE


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