[Rd] gregexpr - match overlap mishandled (PR#13391)

From: <rthompso_at_aecom.yu.edu>
Date: Fri, 12 Dec 2008 18:05:04 +0100 (CET)


Full_Name: Reid Thompson
Version: 2.8.0 RC (2008-10-12 r46696)
OS: darwin9.5.0
Submission from: (NULL) (129.98.107.177)

the gregexpr() function does NOT return a complete list of global matches as it should. this occurs when a pattern matches two overlapping portions of a string, only the first match is returned.

the following function call demonstrates this error (although this is not how I initially discovered the problem):
gregexpr("11221122", paste(rep("1122", 10), collapse=""))

instead of returning 9 matches as one would expect, only 5 matches are returned . . .

[[1]]
[1] 1 9 17 25 33

attr(,"match.length")
[1] 8 8 8 8 8

you will note, essentially, that the entire first match is then excluded from subsequent matching



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 12 Dec 2008 - 17:52:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 12 Dec 2008 - 23:31:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive