[R] : regular expressions: escaping a dot

Wolfram Fischer wolfram at fischer-zim.ch
Thu Jun 28 09:43:57 CEST 2007


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



More information about the R-help mailing list