
Redact social security numbers in text
redact_social_security_numbers.Rd
This function redacts social security numbers in a given text by replacing them with a specified string.
Arguments
- text
The text in which social security numbers are to be redacted.
- replace_with
A string to replace the social security numbers with. It can either be a whole word like "[REDACTED]", or a single character like "*" that gets repeated based on how long the social security number detected is. Default is NULL, which uses the default value specified in the `replace_pattern()` function.
Examples
text <- "My social security number is 123-45-6789. Please don't share it with anyone."
redacted_text <- redact_social_security_numbers(text)
cat(redacted_text)
#> My social security number is [REDACTED]. Please don't share it with anyone.