Closed
Description
There are some more cases where regexes can be optimized away:
For regex detection functions, we can safely replace
grepl("^static_rx", x)
bystartsWith(x, "static_rx")
grepl("static_rx$", x)
byendsWith(x, "static_rx")
grepl("^static_rx$", x)
byx == "static_rx"
For substitution functions, we can replace
gsub("^static_rx$", "replacement", x)
by(function(.) { .[. == "static_rx"] <- "replacement"; . })(x)