I was trying to use regexec to extract number fields from my data and got an 
unexpected response.  I can reproduce the issue with this small test case.

regexec("\\d{2,}", "abcd123")

I get a match at position 1, for length 7.  Not what I expected.

I do get the expected response (match at position 5, for length 3) when I do 
any of the following:

regexec("[0-9]{2,}", "abcd123")
regexec("\\d{1,}", "abcd123")
regexec("\\d+", "abcd123")

I have also verified that regexpr handles this pattern as I expect.

And to add further confusion, this only seems to happen on my Linux machine, 
not on Windows.

This seems to be an incredibly specific condition.  Anybody know what's going 
on?

--
Steve Sentoff

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to