Options
The pattern has to match, not match the whole value, so anchor it with
^ and $ when the whole value must conform. ^\d{4}$ accepts only a four-digit value, while \d{4} accepts anything containing four digits in a row.
Examples
How it behaves
This is the validator, which checks values and leaves them alone. To rewrite a value with a regular expression, use the RegExp formatter instead.