[R] perhaps regular expression bug with | sign ??
David.Epstein
David.Epstein at warwick.ac.uk
Fri Apr 9 22:35:55 CEST 2010
Here is my interaction with R:
> sub(x='>|t|',pattern = '|t',replacement='zz')
[1] "zz>|t|"
So I say to myself "Clearly the | signs need to be escaped, so let's try
this"
> sub(x='>|t|',pattern = '\|t',replacement='zz')
[1] "zz>|t|"
Warning messages:
1: '\|' is an unrecognized escape in a character string
2: unrecognized escape removed from "\|t"
How can \| be an unrecognized escape? This flatly contradicts help('regex'),
or am I misunderstanding the help?
The first pattern above works if one uses extended=F.
What do R experts think?
David
--
View this message in context: http://n4.nabble.com/perhaps-regular-expression-bug-with-sign-tp1819872p1819872.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list