Redact custom patterns with Regex in Portkey.
Guardrails
page and click Create
\b\d{3}-\d{2}-\d{4}\b
for SSN patterns)[REDACTED]
, *****
, [SSN_HIDDEN]
)Pattern Type | Regex Pattern | Replacement Example |
---|---|---|
Credit Card | \b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b | [CREDIT_CARD] |
Social Security Number | \b\d{3}-\d{2}-\d{4}\b | [SSN_REDACTED] |
Phone Numbers | \b\d{3}[-.]\d{3}[-.]\d{4}\b | [PHONE_HIDDEN] |
Email Addresses | \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b | [EMAIL_REDACTED] |
Custom Employee IDs | EMP-\d{6} | [EMPLOYEE_ID] |
before_request_hooks
(input guardrails) and after_request_hooks
(output guardrails) to scan and redact regex patterns in both user inputs and LLM responses.