Split a string, keeping separator regions
strsplit_capture(
x,
split,
...,
ignore.case = FALSE,
fixed = FALSE,
perl = FALSE,
useBytes = FALSE
)
character string to split (length 1 vector)
split pattern
force later arguments to bind by name
passed to gregexpr
passed to gregexpr
passed to gregexpr
passed to gregexpr
list of string segments annotated with is_sep.
strsplit_capture("x is .(x) and x+1 is .(x+1)", "\\.\\([^()]+\\)")
#> [[1]]
#> [1] "x is "
#> attr(,"is_sep")
#> [1] FALSE
#>
#> [[2]]
#> [1] ".(x)"
#> attr(,"is_sep")
#> [1] TRUE
#>
#> [[3]]
#> [1] " and x+1 is "
#> attr(,"is_sep")
#> [1] FALSE
#>
#> [[4]]
#> [1] ".(x+1)"
#> attr(,"is_sep")
#> [1] TRUE
#>