search for: capture_first_vec

Displaying 1 result from an estimated 1 matches for "capture_first_vec".

2024 Jan 29
1
strcapture performance when perl = TRUE
...of regexec (conditionally when perl = TRUE). To illustrate this I've put together a 'proof of concept' function called strcapture2 that utilises output from regexpr directly (following a very nice substring approach that I've seen implemented by Toby Hocking in the nc package - nc::capture_first_vec). strcapture2 <- function(pattern, x, proto, perl = FALSE, useBytes = FALSE) { if (isTRUE(perl)) { m <- regexpr(pattern = pattern, text = x, perl = TRUE, useBytes = useBytes) nomatch <- is.na(m) | m == -1L ntokens <- length(proto) if (any(!nomatch))...