> ## 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

<Steps>
  <Step title="Open Evaluate from your prompt">
    Open the prompt you want to test and click **Evaluate** in the prompt header.

    <img src="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" alt="Opening the Evaluate tab from a prompt" title="Opening the Evaluate tab from a prompt" style={{ width: "100%" }} width="3456" height="1839" data-path="images/evaluate/open-evaluate-tab.png" />
  </Step>

  <Step title="Select the evaluator">
    Add the Text Matcher evaluator from the evaluator menu.

    <img src="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" alt="Selecting the Text Matcher evaluator" title="Selecting the Text Matcher evaluator" style={{ width: "100%" }} width="1275" height="778" data-path="images/evaluate/add-text-matcher-evaluator.png" />
  </Step>

  <Step title="Configure matching rules">
    Give the evaluator a name, link a dataset, and define the text matching rules.

    <img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/matching-text.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=6c85274ed25db9a90b3cd5f166170fed" alt="Configuring text matching rules" title="Configuring text matching rules" style={{ width: "100%" }} width="1154" height="443" data-path="images/evaluate/matching-text.png" />

    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.                |
  </Step>

  <Step title="Run the evaluation">
    Click **Evaluate** to execute the evaluation and see the results.

    <img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-results.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=0b4faf6111347f950374da5fd8160797" alt="Text Matcher evaluator results" title="Text Matcher evaluator results" style={{ width: "100%" }} width="1144" height="812" data-path="images/evaluate/text-matcher-results.png" />
  </Step>
</Steps>

## Examples

### Find SEO-oriented keywords

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

<img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-seo-oriented.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=a0f061c8a84729a54fd27a95bc403791" alt="Finding SEO-oriented keywords" title="Finding SEO-oriented keywords" style={{ width: "100%" }} width="1144" height="238" data-path="images/evaluate/text-matcher-seo-oriented.png" />

### Ensure the response begins with a specific phrase

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

<img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-phrase-beginning.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=28c1e045c4c94de5025a2727bd91c99f" alt="Ensuring a response starts with a specific phrase" title="Ensuring a response starts with a specific phrase" style={{ width: "100%" }} width="1021" height="176" data-path="images/evaluate/text-matcher-phrase-beginning.png" />

### Ensure the response does not contain personal information

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

<img src="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" alt="Blocking personal information in responses" title="Blocking personal information in responses" style={{ width: "100%" }} width="1029" height="216" data-path="images/evaluate/text-matcher-no-personal-info.png" />

### Validate format with regex

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

<img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/evaluate/text-matcher-regex.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=1704ffb1dc0633889cbd5fe8bf95e92d" alt="Using regex in the Text Matcher" title="Using regex in the Text Matcher" style={{ width: "100%" }} width="1188" height="281" data-path="images/evaluate/text-matcher-regex.png" />

## 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](/docs/evaluate/javascript). For qualitative assessment, use [LLM-as-a-Judge](/docs/evaluate/llm-as-a-judge).

## Next steps

<CardGroup cols={2}>
  <Card title="JavaScript Evaluator" icon="code" href="/docs/evaluate/javascript">
    Write custom code for more complex validation.
  </Card>

  <Card title="LLM-as-a-Judge" icon="gavel" href="/docs/evaluate/llm-as-a-judge">
    Use an LLM for qualitative assessment.
  </Card>
</CardGroup>
