Skip to contents

This function takes a string and replaces any occurrences of a 4 digit pin

Usage

redact_pins(text, replace_with = NULL)

Arguments

text

A character string.

replace_with

A character string to replace the matched pattern with. If NULL, defaults to "[REDACTED]".

Value

The input string with any 4 digit pins replaced with [REDACTED].

Examples

redact_pins("My pin is 1234")
#> [1] "My pin is [REDACTED]"
redact_pins("Her PIN is 9876")
#> [1] "Her PIN is [REDACTED]"