5.5.2. mroonga_escape() — Mroonga vmrn_version documentation

Skip to main content
`Ctrl`+`K`

# 5.5.2. `mroonga_escape()`

Added in version 3.08.

## 5.5.2.1. Summary

`mroonga_escape` UDF provides functionality to escape given string. It also accepts parameter what character should be escaped.

## 5.5.2.2. Syntax

`mroonga_escape()` has required parameter and optional parameter:

    mroonga_escape(string)
    mroonga_escape(string, special_characters)

## 5.5.2.3. Usage

Here is the example query which use special characters to be escaped:

    SELECT * FROM `symbols` WHERE MATCH(`content`) AGAINST(mroonga_escape("+hello_world()", "()") IN BOOLEAN MODE);

Here is the example about special characters which is escaped:

    SELECT mroonga_escape("+-<>~*()\"\\\:");
    -- \+\-\<\>\~\*\(\)\"\\\:

## 5.5.2.4. Parameters

### 5.5.2.4.1. Required parameters

There is one required parameter, `string`.

#### 5.5.2.4.1.1. `string`

It specifies text which you want to escape.

### 5.5.2.4.2. Optional parameters

There is one optional parameter, `special_characters`.

#### 5.5.2.4.2.1. `special_characters`

It specifies characters to escape.

The default value is `+-<>~*()"\\:`.

## 5.5.2.5. Return value

It returns escaped string.