Normandy.Guardrails.Builtins.RegexGuard (normandy v0.6.0)

View Source

Rejects (or requires) regex matches against a string.

Useful for simple PII patterns (SSN, credit-card-like digit runs) in :deny mode, or for ensuring a response contains a required marker in :require mode.

Options

  • :patterns (required) — list of compiled Regex.t() values. Must be non-empty.
  • :mode (optional, default :deny) — :deny rejects when any pattern matches; :require rejects when no pattern matches.
  • :field (optional) — atom naming a field to extract from a struct or map before checking.

Empty :deny against a nil/missing field is a no-op. Empty :require against a nil/missing field is a violation — the required pattern couldn't possibly be present in missing text.