Skip to contents

This function searches a text string for website URLs and replaces them with a specified value or the default value of "[REDACTED]".

Usage

redact_website_urls(text, replace_with = NULL)

Arguments

text

A character string containing the text to be searched and redacted

replace_with

A character string that specifies the value to replace the matched domains with. If this argument is not specified, the default value of "[REDACTED]" will be used.

Value

A character string with matched domains replaced with the specified or default value

Examples

text <- "Visit our website at www.example.com for more information."
redact_website_urls(text)
#> [1] "Visit our website at [REDACTED] for more information."