I suspect that there is bug in sub when using "?":> string_"This is a bug!" > sub("!", ", or isn't it?", string)[1] "This is a bug, or isn't it?"> string_"This is a bug?" > sub("?", ", or isn't it?", string)[1] "This is a bug?" Regards, *** D.Trenkler *** ===================================================================Dietrich Trenkler (trenkler@oec.uni-osnabrueck.de) Statistik / Empirische Wirtschaftsforschung Universitaet Osnabrueck Rolandstrasse 8 Phone: +49(0) 541-969-2753 D-49069 Osnabrueck Fax : +49(0) 541-969-2745 GERMANY =================================================================== --please do not edit the information below-- Version: platform = Windows arch = x86 os = Win32 system = x86, Win32 status = major = 1 minor = 0.0 year = 2000 month = February day = 29 language = R Windows NT 4.0 (build 1381) Service Pack 3 Search Path: .GlobalEnv, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> I suspect that there is bug in sub when using "?": > > > string_"This is a bug!" > > sub("!", ", or isn't it?", string) > [1] "This is a bug, or isn't it?" > > string_"This is a bug?" > > sub("?", ", or isn't it?", string) > [1] "This is a bug?"R> string_"This is a bug?" R> sub("[?]", ", or isn't it?", string) [1] "This is a bug, or isn't it?" works, has "?" a special meaning in regexp? Torsten> > > Regards, > > *** D.Trenkler *** > > ===================================================================> Dietrich Trenkler (trenkler@oec.uni-osnabrueck.de) > Statistik / Empirische Wirtschaftsforschung > Universitaet Osnabrueck > Rolandstrasse 8 Phone: +49(0) 541-969-2753 > D-49069 Osnabrueck Fax : +49(0) 541-969-2745 > GERMANY > ===================================================================> > > --please do not edit the information below-- > > Version: > platform = Windows > arch = x86 > os = Win32 > system = x86, Win32 > status = > major = 1 > minor = 0.0 > year = 2000 > month = February > day = 29 > language = R > > Windows NT 4.0 (build 1381) Service Pack 3 > > Search Path: > .GlobalEnv, Autoloads, package:base > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
dtrenkler@nts6.oec.uni-osnabrueck.de writes:> I suspect that there is bug in sub when using "?": > > > string_"This is a bug!" > > sub("!", ", or isn't it?", string) > [1] "This is a bug, or isn't it?" > > string_"This is a bug?" > > sub("?", ", or isn't it?", string) > [1] "This is a bug?"Hmm. If there is a bug it may not where you think... '?' is an operator of extended regular expressions, so you're not looking for a question mark there:> sub("\\?", ", or isn't it?", string)[1] "This is a bug, or isn't it?"> sub("?", ", or isn't it?", ext=F, string)[1] "This is a bug, or isn't it?" One might expect that a null RE would always match the beginning of a string, but it doesn't... -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._