Re: [R-SIG-Mac] Fwd: [R] extracting a matched string using regexpr Possible BUG

2010-05-06 Thread David Winsemius
On May 6, 2010, at 2:21 AM, steven mosher wrote: see below, using a regex in sub() fails if the pattern is //d{5} and suceeds if the pattern [0-9] {5} is used.. see the test cases below. issue was not on windows machine and david and I had it on MAC. Except we both were using \\d rather

Re: [R-SIG-Mac] Fwd: [R] extracting a matched string using regexpr Possible BUG

2010-05-06 Thread steven mosher
Thanks David, After struggling with this bug for a day I think Im permanently dain bramaged. On Thu, May 6, 2010 at 3:54 AM, David Winsemius dwinsem...@comcast.netwrote: On May 6, 2010, at 2:21 AM, steven mosher wrote: see below, using a regex in sub() fails if the pattern is

Re: [R-SIG-Mac] Fwd: [R] extracting a matched string using regexpr Possible BUG

2010-05-06 Thread Simon Urbanek
FWIW I don't think \d is a basic regexp so as I would expect the perl mode to work and it does: test2-aaa12345W sub(.*(\\d{5}).*, \\1, test2,perl=TRUE) [1] 12345 Yet I agree that if should either fail (i.e. return the unmodified string) or return 12345. Also note

Re: [R-SIG-Mac] Fwd: [R] extracting a matched string using regexpr Possible BUG

2010-05-06 Thread David Winsemius
Two Q's: A) Is this supposed to happen with perl-mode?: test-/trtrth88958/ththAbcdsef/thth67.8S/ thth68.9\nW/thth26m/th sub(.*(\\d{5}).*, \\1, test, perl=TRUE) [1] 88958\nW/thth26m/th sub(.*([0-9]{5}).*, \\1, test, perl=TRUE) [1] 88958\nW/thth26m/th Looks to me that a period is being

Re: [R-SIG-Mac] Fwd: [R] extracting a matched string using regexpr Possible BUG

2010-05-06 Thread Simon Urbanek
On May 6, 2010, at 11:50 AM, David Winsemius wrote: Two Q's: A) Is this supposed to happen with perl-mode?: test-/trtrth88958/ththAbcdsef/thth67.8S/thth68.9\nW/thth26m/th sub(.*(\\d{5}).*, \\1, test, perl=TRUE) [1] 88958\nW/thth26m/th sub(.*([0-9]{5}).*, \\1, test, perl=TRUE) [1]