[R] : regular expressions: escaping a dot

From: Wolfram Fischer <wolfram_at_fischer-zim.ch>
Date: Thu, 28 Jun 2007 09:43:57 +0200


What's really the problem with:

> regexpr( '\.odt$', "xxxxYodt", perl=TRUE )

	Warning: '\.' is an unrecognized escape in a character string
	Warning: unrecognized escape removed from "\.odt$"
	[1] 5
	attr(,"match.length")
	[1] 4

I know that I could use:
> regexpr( '[.]odt$', "xxxxYodt", perl=TRUE )

But it seems to me that the first expression is also an accepted regular expression in accordance with perl.

Regards - Wolfram



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 28 Jun 2007 - 07:50:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Jun 2007 - 09:32:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.