🔍 An RStudio addin slash regex utility belt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
438B

  1. context("test-regex")
  2. test_that("expand_matches gives data frame of indices with groups", {
  3. m <- regexec("(a)(b)(d)?", "abcaba")
  4. idx <- dplyr::data_frame(
  5. start = c(1L, 1L, 2L, NA_integer_),
  6. end = c(3L, 2L, 3L, NA_integer_),
  7. group = c(0L, 1L, 2L, 3L)
  8. )
  9. expect_equal(expand_matches(m[[1]]), idx)
  10. })
  11. test_that("max_match_index works", {
  12. m <- run_regex(c("abcaba", "aba", "z"), c("(a)(b)(d)?c?"), global = TRUE)
  13. })