| @@ -581,7 +581,7 @@ regex_gadget <- function(text = NULL, | |||
| sanitize_text_input <- function(x) { | |||
| if (is.null(x) || !nchar(x)) return(x) | |||
| rx_unicode <- "\\u[0-9a-f]{4,8}" | |||
| rx_unicode <- "\\\\u[0-9a-f]{4,8}" | |||
| rx_hex <- "\\\\x[0-9a-f]{2}|\\\\x\\{[0-9a-f]{1,6}\\}" | |||
| rx_octal <- "\\\\[0][0-7]{1,3}" | |||
| rx_escape <- paste(rx_unicode, rx_hex, rx_octal, sep = "|") | |||
| @@ -8,6 +8,7 @@ test_that("sanitizes unicode", { | |||
| # rx_unicode <- "\\u[0-9a-f]{4,8}" | |||
| expect_equal(sanitize_text_input("\\u2019"), "\u2019") | |||
| expect_equal(sanitize_text_input("\\u000D"), "\r") | |||
| expect_equal(sanitize_text_input("\\U0001F575"), "\U001F575") | |||
| }) | |||
| test_that("sanitizes hex", { | |||