search for: grep1r

Displaying 2 results from an estimated 2 matches for "grep1r".

2017 Apr 05
0
Bug report: POSIX regular expression doesn't match for somewhat higher values of upper bound
...--------------- tx <- c("ab","abc", paste0("foo", c("", "b", "o", "bar", "oofy"))) setNames(nchar(tx), tx) ## ab abc foo foob fooo foobar foooofy ## 2 3 3 4 4 6 7 grep1r <- function(n, txt, ...) { pattern <- paste0('(.{1,',n,'})\\1', collapse="") ## can have empty n ans <- grep(pattern, txt, value=TRUE, ...) cat(sprintf("pattern '%s' : ", pattern)); print(ans, quote=FALSE) invisible(ans) } grep1r...
2017 Apr 04
2
Bug report: POSIX regular expression doesn't match for somewhat higher values of upper bound
Dear Sirs, while > regexpr('(.{1,2})\\1', 'foo') [1] 2 attr(,"match.length") [1] 2 attr(,"useBytes") [1] TRUE yields the correct match, an incremented upper bound in > regexpr('(.{1,3})\\1', 'foo') [1] -1 attr(,"match.length") [1] -1 attr(,"useBytes") [1] TRUE incorrectly yields no match. R versions tested: 2.11.1