---
title: "Test and preview a regex pattern by evaluating it against sample input text. Optionally provide a maskString to use as the replacement for text that matches the regex."
method: POST
path: "/v1/dataMaskingRules/evaluate"
tags: ["dataMaskingManagement"]
---

# Test and preview a regex pattern by evaluating it against sample input text. Optionally provide a maskString to use as the replacement for text that matches the regex.

`POST /v1/dataMaskingRules/evaluate`

Evaluate a regex pattern against input text. This endpoint can be used to test regex patterns for data masking rules. You can provide your own mask string which will be used for masking, otherwise it will be masked with default value of ##redactedPII##. The response includes the masked text, match count, and positions of matches in the masked output text.

## Request body

- DataMaskingEvaluateDefinition
  - `regexPattern` string, required — Regex pattern used to identify substrings to mask.
  - `maskString` string, nullable — Optional mask string. If null or empty, the service may apply a default mask string.
  - `text` string, required — Sample message used for masking evaluation.

## Response `200`

Evaluation result for the provided sample message.

- DataMaskingEvaluateResponse
  - `maskedText` string, required — Message after applying masking.
  - `matchCount` integer, required — Number of replaced matches.
  - `matchPositions` DataMaskingMatchPosition[], required — Start/end offsets for each replaced segment in the output string.
    - `start` integer, required — Start index of masked segment in output string (inclusive).
    - `end` integer, required — End index of masked segment in output string (exclusive).

## Other responses

- `default` — Operation failed with an error.

---

[API](https://skmtc.net/sumologic/apis/sumo-logic-api.md) · [All operations](https://skmtc.net/sumologic/apis/sumo-logic-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sumologic/sumo-logic-api/revisions/18a824df1e78/schema)
