# RegexMatchStringEvaluator

> **Class** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/evaluation/regex_match/base/RegexMatchStringEvaluator)

Compute a regex match between the prediction and the reference.

Examples:
----------
>>> evaluator = RegexMatchStringEvaluator(flags=re.IGNORECASE)
>>> evaluator.evaluate_strings(
        prediction="Mindy is the CTO",
        reference="^mindy.*cto$",
    )  # This will return {'score': 1.0} due to the IGNORECASE flag

>>> evaluator = RegexMatchStringEvaluator()
>>> evaluator.evaluate_strings(
        prediction="Mindy is the CTO",
        reference="^Mike.*CEO$",
    )  # This will return {'score': 0.0}

>>> evaluator.evaluate_strings(
        prediction="Mindy is the CTO",
        reference="^Mike.*CEO$|^Mindy.*CTO$",
    )  # This will return {'score': 1.0} as the prediction matches the second pattern in the union

## Signature

```python
RegexMatchStringEvaluator(
    self,
    *,
    flags: int = 0,
    **_: Any = {},
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `flags` | `int` | No | Flags to use for the regex match. Defaults to no flags. (default: `0`) |

## Extends

- `StringEvaluator`

## Constructors

```python
__init__(
    self,
    *,
    flags: int = 0,
    **_: Any = {},
)
```

| Name | Type |
|------|------|
| `flags` | `int` |


## Properties

- `flags`
- `requires_input`
- `requires_reference`
- `input_keys`
- `evaluation_name`

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/6fb37dba71da807af60aa7b909f71f0625a666bf/libs/langchain/langchain_classic/evaluation/regex_match/base.py#L9)