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

2011-04-29 Thread Miao
That works like a charm! Thanks so much Duncan. On Fri, Apr 29, 2011 at 6:37 PM, Duncan Murdoch wrote: > On 29/04/2011 9:34 PM, Miao wrote: > >> Thanks Duncan for clarifying this. I'm pretty a newbie to such type of >> characters and special characters. In R's gsub() what regular >> expression

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

2011-04-29 Thread Mike Miller
On Fri, 29 Apr 2011, Duncan Murdoch wrote: On 29/04/2011 7:41 PM, Miao wrote: 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

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

2011-04-29 Thread Duncan Murdoch
On 29/04/2011 9:34 PM, Miao wrote: Thanks Duncan for clarifying this. I'm pretty a newbie to such type of characters and special characters. In R's gsub() what regular expressions shall I use to handle all these situations? I don't know. This might work: gsub("[\x01-\x1f\x7f-\xff]", "", x)

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

2011-04-29 Thread Miao
Thanks Duncan for clarifying this. I'm pretty a newbie to such type of characters and special characters. In R's gsub() what regular expressions shall I use to handle all these situations? On Fri, Apr 29, 2011 at 6:07 PM, Duncan Murdoch wrote: > On 29/04/2011 7:41 PM, Miao wrote: > >> Hello, >

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

2011-04-29 Thread Duncan Murdoch
On 29/04/2011 7:41 PM, Miao wrote: Hello, 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