Bug 17259 - TRE/POSIX regular expression doesn't match for somewhat higher values of upper bound
Summary: TRE/POSIX regular expression doesn't match for somewhat higher values of uppe...
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R 3.3.*
Hardware: All All
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2017-04-18 09:11 UTC by Dietmar Schindler
Modified: 2017-04-18 09:11 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dietmar Schindler 2017-04-18 09:11:07 UTC
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 on i486-pc-linux-gnu
2.15.1 on x86_64-pc-linux-gnu
3.2.1 on i386-w64-mingw32
3.2.1 on x86_64-w64-mingw32
3.3.3 on x86_64-w64-mingw32

An elaboration using grep() instead of regexpr() by Martin Maechler is provided here: https://stat.ethz.ch/pipermail/r-devel/2017-April/074030.html