# escape

The `escape` statement is used to escape quotes in a variable value or the contents of a named buffer

## Syntax

**`escape quotes in`***`varName|{bufferName}`***`[using`***`escape_char]`*

## Details

If a variable value or named buffer contains quotes then it may be desirable to escape them, either for display purposes (to prevent USE from removing them before rendering the data as output) or in order to satisfy the requirements of an external API.

The `escape` statement will precede all occurrences of the character `"` with a specified escape character (backslash by default) as shown in the example below. This operation is not just temporary - it will update the actual contents of the variable or named buffer.

{% hint style="danger" %}
The `escape` statement does not take into account the context of existing quote characters in the data. Running it multiple times against the same data will add an additional escape character each time to each occurrence of a quote.
{% endhint %}

## Example

Given an input file called 'escapeme.txt' containing the following data:

```
"this "is some text" with
some "quotes" in it"
```

The following script:

```
buffer test = FILE system/extracted/escapeme.txt
escape quotes in {test}
print {test}

var testvar = "\"This is \"a test\" string\""
escape quotes in testvar using \"
print ${testvar}
```

will produce the following output:

```
\"this \"is some text\" with
some \"quotes\" in it\"

""This is ""a test"" string""
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olddocs.exivity.io/2.10.2/data-pipelines/extract/language/escape.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
