# RegEx - Input Validation

The **RegEx** metadata type can be used to validate and enforce that users enter a value in a specific format.

For example, if a *production ID* must follow a strict rule — **one uppercase letter followed by five digits** — this metadata type can ensure that only valid IDs are accepted.

The corresponding regular expression is:

```
^[A-Z]\d{5}$
```

This expression enforces the following:

* `^` — start of the string
* `[A-Z]` — exactly one uppercase letter
* `\d{5}` — exactly five digits (0–9)
* `$` — end of the string

As a result, valid values would include `A12345` or `Z00001`, while entries such as `AA12345`, `a12345`, or `A1234` would be rejected.

To configure this, a regular expression (regex) pattern must be defined.\
If you need help creating a suitable expression, you can use online generators or tools such as:\
<https://www.leiga.com/free-tools/regex-expression-generator>

Enter the regex pattern in the **Default Value** field.

The **Value** field should remain empty. The displayed warning can be ignored.

<figure><img src="https://1398472304-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcJYkTyk9qgh7aCR6dHIm%2Fuploads%2FOqJdQjKOaISckk4vBroU%2Fimage.png?alt=media&#x26;token=2986a0c1-8a89-4171-a2f7-f60b231bbbd4" alt=""><figcaption><p>Regex metadata</p></figcaption></figure>

#### Limitation

If a RegEx metadata type is assigned to either a **group** or a **metadata set**, the field *must always be filled with a valid value*.\
This metadata type effectively behaves as a mandatory field, because the input validation prevents saving empty or invalid values. Disabling this requirement is not possible.
