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

# Text matcher

> Validate prompt responses with precise text pattern matching and keyword detection

The Text Matcher evaluator examines the textual content of your LLM's response to check for specific patterns, keywords, or regex matches. Use it to enforce content requirements, detect unwanted text, or validate response format — all without writing code.

## Set up the Text Matcher evaluator

**1. Open Evaluate from your prompt**

Open the prompt you want to test and click **Evaluate** in the prompt header.

![Opening the Evaluate tab from a prompt](https://mintcdn.com/adaline/6qZ1-Sm8NeEttI_w/images/evaluate/open-evaluate-tab.png?fit=max\&auto=format\&n=6qZ1-Sm8NeEttI_w\&q=85\&s=8a70c493b8cafd7a141b0220eff30640)

**2. Select the evaluator**

Add the Text Matcher evaluator from the evaluator menu.

![Selecting the Text Matcher evaluator](https://mintcdn.com/adaline/6qZ1-Sm8NeEttI_w/images/evaluate/add-text-matcher-evaluator.png?fit=max\&auto=format\&n=6qZ1-Sm8NeEttI_w\&q=85\&s=96e40064eae75ea0550bf53a56bdc76c)

**3. Configure matching rules**

Give the evaluator a name, link a dataset, and define the text matching rules.

![Configuring text matching rules](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/matching-text.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=6c85274ed25db9a90b3cd5f166170fed)

Choose from the following match types:

| Match type | Behavior |
| - | - |
| **equals** | The response must match your text exactly. |
| **starts-with** | The response must begin with your specified text. |
| **ends-with** | The response must conclude with your specified text. |
| **contains-any** | The response must include at least one item from your array of strings. |
| **contains-all** | The response must include every item from your array of strings. |
| **not-contains-any** | The response must not include any item from your array of strings. |
| **regex** | The response must match your regular expression pattern. |

**4. Run the evaluation**

Click **Evaluate** to execute the evaluation and see the results.

![Text Matcher evaluator results](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-results.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=0b4faf6111347f950374da5fd8160797)

## Examples

### Find SEO-oriented keywords

Use `contains-all` or `contains-any` to ensure responses include target keywords:

![Finding SEO-oriented keywords](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-seo-oriented.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=a0f061c8a84729a54fd27a95bc403791)

### Ensure the response begins with a specific phrase

Use `starts-with` to enforce a consistent response opening:

![Ensuring a response starts with a specific phrase](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-phrase-beginning.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=28c1e045c4c94de5025a2727bd91c99f)

### Ensure the response does not contain personal information

Use `not-contains-any` to detect and flag responses that leak sensitive data:

![Blocking personal information in responses](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-no-personal-info.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=6cbd5874410863733f57be1a4a97ea1b)

### Validate format with regex

Use `regex` to enforce structural patterns (e.g., lowercase letters and numbers only):

![Using regex in the Text Matcher](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-regex.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=1704ffb1dc0633889cbd5fe8bf95e92d)

## When to use

* **Keyword enforcement** — Ensure required terms or phrases appear in responses (SEO, compliance, branding).
* **Content safety** — Block responses containing banned words, personal information, or inappropriate content.
* **Format validation** — Check that responses follow a specific format (e.g., starts with a greeting, ends with a call to action).
* **Simple pattern checks** — Validate output structure with regex (email patterns, phone numbers, structured IDs).

For complex multi-step validation, consider the [JavaScript evaluator](https://www.adaline.ai/docs/evaluate/javascript.md). For qualitative assessment, use [LLM-as-a-Judge](https://www.adaline.ai/docs/evaluate/llm-as-a-judge.md).

## Next steps

> [card] [JavaScript Evaluator](https://www.adaline.ai/docs/evaluate/javascript.md)
>
> Write custom code for more complex validation.

> [card] [LLM-as-a-Judge](https://www.adaline.ai/docs/evaluate/llm-as-a-judge.md)
>
> Use an LLM for qualitative assessment.


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