-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
I'm trying to replace text a specific column of the line, hence the natural approach I saw is:
gsub("^(.{N})FOO", "\\1BAR", x)i.e., capture whatever the first N characters are and, if they are followed by FOO, replace FOO with BAR (retaining whatever the first N characters were).
Here's my attempt in rex():
N = 12L
pattern <- rex(
start,
capture(n_times(anything, N)),
"function"
)But the resulting pattern generates infinite recursion (it seems):
grepl(ptn, " lapply(y, function(yi) {", perl = TRUE)
# Warning message:
# In grepl(ptn, " lapply(y, function(yi) {", perl = TRUE) :
# back-tracking limit reached in PCRE for element 1Actually, I am suspecting this might be an R / PCRE regex bug given how hard it was to come up with a more minimal reprex...
Metadata
Metadata
Assignees
Labels
No labels