[R] gregexpr in R 2.3.0 != gregexpr in R 2.4.0

2006-10-06 Thread Stefan Th. Gries
Hi all I have a question regarding differences in the way gregpexr works in R 2.3.0 and R 2.4.0. In R 2.3.0, this is what happens: > gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T) [[1]] [1] 1 3 5 7 9 attr(,"match.length") [1] 5 5 5 5 5 ... while in R 2.4.0, this is what happens: > gregex

Re: [R] gregexpr in R 2.3.0 != gregexpr in R 2.4.0

2006-10-06 Thread Gabor Grothendieck
You can get that by using zero width lookahead assertions. They must match but are not consuming so the next match will not be forced to start past them. See ?regex and http://www.regular-expressions.info/lookaround.html for more. gregexpr(" [a-z](?= [a-z] )", " a b c d e f ", perl = TRUE) O

Re: [R] gregexpr in R 2.3.0 != gregexpr in R 2.4.0

2006-10-06 Thread Duncan Murdoch
On 10/6/2006 10:00 PM, Stefan Th. Gries wrote: > Hi all > > I have a question regarding differences in the way gregpexr works in R 2.3.0 > and R 2.4.0. > > In R 2.3.0, this is what happens: > >> gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T) > [[1]] > [1] 1 3 5 7 9 > attr(,"match.length") >