[R] regular expression in gsub() for strings with leading backslash

From: Miao <glycob_at_gmail.com>
Date: Fri, 29 Apr 2011 16:41:10 -0700


Can anyone help on gsub() in R? I have a string like something below, and wanted to delete all the strings with leading backslash, including "\xa0On", "\023, "\xab", and many others. How should I write a regular expression pattern in gsub()? I don't care how many characters following backslash.

txt <- "Is This Thing\xa0On? http://bit.ly/jAbKem wait \023 for people \xab and be patient :"

Thanks in advance,

        [[alternative HTML version deleted]]

R-help_at_r-project.org 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 Fri 29 Apr 2011 - 23:49:21 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 Sat 30 Apr 2011 - 01:20:35 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.

list of date sections of archive