> For the complete documentation index, see [llms.txt](https://docs.documint.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.documint.me/templates/working-with-dynamic-data/functions-and-operators/operators/string-operators.md).

# String Operators

### startsWith&#x20;

`{{$startsWith string1 string2}}`

Evaluates to `true` if `string1` starts with `string2`.

**Arguments**

<table><thead><tr><th width="150">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>string1</td><td>A static value or a variable path to check for <code>string2</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr><tr><td>string2</td><td>A static value or a variable path to check for in <code>string1</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

{% tabs %}
{% tab title="Template" %}
{{#if ($startsWith movie "Bourne") }}Movie starts with Bourne{{/if}}
{% endtab %}

{% tab title="Data" %}

```json
{
    "movie":"Bourne Identity"
}
```

{% endtab %}

{% tab title="Result" %}
Movie starts with Bourne
{% endtab %}
{% endtabs %}

### endsWith&#x20;

`{{$endsWith string1 string2}}`

Evaluates to true if `string1` ends with `string2`.

**Arguments**

<table><thead><tr><th width="150">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>string1</td><td>A static value or a variable path to check for <code>string2</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr><tr><td>string2</td><td>A static value or a variable path to check for in <code>string1</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

{% tabs %}
{% tab title="Template" %}
{{#if ($endsWith movie "Story") }}Movie ends with Story{{/if}}
{% endtab %}

{% tab title="Data" %}

```json
{
    "movie":"Toy Story"
}
```

{% endtab %}

{% tab title="Result" %}
Movie ends with Story
{% endtab %}
{% endtabs %}

### contains&#x20;

`{{$contains string1 string2}}`

Evaluates to true if `string1` exists in `string2`.

**Arguments**

<table><thead><tr><th width="150">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>string1</td><td>A static value or a variable path to check for <code>string2</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr><tr><td>string2</td><td>A static value or a variable path to check for in <code>string1</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

{% tabs %}
{% tab title="Template" %}
{{#if ($contains movie "Bronx") }}Movie contains Bronx{{/if}}
{% endtab %}

{% tab title="Data" %}

```json
{
    "movie":"A Bronx Tale"
}
```

{% endtab %}

{% tab title="Result" %}
Movie contains Bronx
{% endtab %}
{% endtabs %}

### doesNotContain

`{{$doesNotContain string1 string2}}`

Evaluates to `true` if `string1` does not exist in `string2`.

**Arguments**

<table><thead><tr><th width="150">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>string1</td><td>A static value or a variable path to check for <code>string2</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr><tr><td>string2</td><td>A static value or a variable path to check for in <code>string1</code></td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

{% tabs %}
{% tab title="Template" %}
{{#if ($doesNotContian movie "Batman") }}Movie does not contain Batman{{/if}}
{% endtab %}

{% tab title="Data" %}

```json
{
    "movie":"The Dark Knight"
}
```

{% endtab %}

{% tab title="Result" %}
Movie does not contain Batman
{% endtab %}
{% endtabs %}

### matches

`{{$matches string expression}}`

Returns `true` if `string` matches a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).

**Arguments**

<table><thead><tr><th width="141">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>string</td><td>A static value or a variable path to evaluate the regular expression against</td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr><tr><td>expression</td><td>Regular expression to evaluate</td><td><span data-option="b0403385da1b4af9a8a894cb7cfa1e88">String</span></td><td>true</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

{% tabs %}
{% tab title="Template" %}
{{#if ($matches category "^spo.\*") }}Category matches regular expression{{/if}}
{% endtab %}

{% tab title="Data" %}

```
{
    "category":"sports"
}
```

{% endtab %}

{% tab title="Result" %}
Category matches regular expression
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.documint.me/templates/working-with-dynamic-data/functions-and-operators/operators/string-operators.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
