Re: [R] Is there a better way to parse strings than this?

From: Chris Howden <>
Date: Tue, 19 Apr 2011 11:36:21 +1000

Thanks for the explanation,

I think I understand it now. So to paraphrase all your explanations

To match "." in a regular expression then the string "\.\.\." needs to be passed to it. This tells it to escape the special meaning of ".". But in order to get the \ into the string being passed to the function I also need to escape its special meaning, so I need to use "\\.\\.\\."

Chris Howden
Founding Partner
Tricky Solutions
Tricky Solutions 4 Tricky Problems
Evidence Based Strategic Development, IP Commercialisation and Innovation, Data Analysis, Modelling and Training
(mobile) 0410 689 945
(fax / office) (+618) 8952 7878

-----Original Message-----
From: [] On Behalf Of Hadley Wickham
Sent: Friday, 15 April 2011 11:07 AM
To: Chris Howden
Subject: Re: [R] Is there a better way to parse strings than this?

> I was trying strsplit(string,"\.\.\.") as per the suggestion in Venables
> and Ripleys book to "(use '\.' to match '.')", which is in the Regular
> expressions section.
> I noticed that in the suggestions sent to me people used:
> strsplit(test,"\\.\\.\\.")
> Could anyone please explain why I should have used "\\.\\.\\." rather
> "\.\.\."?



Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 19 Apr 2011 - 01:39:32 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 Tue 19 Apr 2011 - 03:00:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive