# regex

The `regex` option of an extract field.

A regular expression applied to the located element's text (or HTML, with `source`), or to the whole document when the field has no other locator. The first capture group is the value, or the whole match without one.

Type: `string`

## Example

```json
{
  "total": {
    "regex": "Total:\\s*([0-9.]+)",
    "type": "number"
  }
}
```

From the contract fixture `evaluate-opaque`, a program the test suite validates.
