tests/testthat/test-escape.R

test_that("re_escape works", {
  expect_equal(
    re_escape(".^$|*+?{}[]()"),
    "\\.\\^\\$\\|\\*\\+\\?\\{\\}\\[\\]\\(\\)"
  )
  expect_equal(re_escape("\\"), "\\\\")
})

Try the re package in your browser

Any scripts or data that you put into this service are public.

re documentation built on Sept. 11, 2024, 5:36 p.m.