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")
>
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
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