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