From amiransk at uwo.ca  Mon Jan 19 19:25:12 2009
From: amiransk at uwo.ca (amiransk at uwo.ca)
Date: Mon, 19 Jan 2009 19:25:12 +0100 (CET)
Subject: [Rd] sub and gsub treat \\ incorrectly (PR#13454)
Message-ID: <20090119182513.1B9FC282EFC1@mail.pubhealth.ku.dk>

Sub and gsub treat \\ replacement pattern incorrectly

I expect
  sub("a","\\", "a", perl=T)
to produce
  [1] "\"
instead it generates
  [1] ""

On the other hand, if I run
  sub("a","\\\\", "a", perl=T)
it correctly outputs
  [1] "\\"

The same issue applies to gsub.

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 2
 minor = 8.1
 year = 2008
 month = 12
 day = 22
 svn rev = 47281
 language = R
 version.string = R version 2.8.1 (2008-12-22)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base

-- 
Sincerely,
 Andriy



[Rd] sub and gsub treat \\ incorrectly (PR#13454)
amiransk at uwo.ca