Skip to contents

This function redacts IP addresses in a given text by replacing them with a specified string.

Usage

redact_ip_addresses(text, replace_with = NULL)

Arguments

text

The text in which IP addresses are to be redacted.

replace_with

A string to replace IP addresses with. It can be either a whole word pattern or a single character. Default is NULL, which uses the default value specified in the `replace_pattern()` function.

Value

A character vector with redacted IP addresses.

Examples

text <- "My IP address is 192.168.0.1. Please don't share it with anyone."
redacted_text <- redact_ip_addresses(text)
cat(redacted_text)
#> My IP address is [REDACTED]. Please don't share it with anyone.