Re: [R] Replacing a string

2012-11-04 Thread Allie818
Thanks so much Arun! It's the second case. Being able to extract is really powerful too. Thank you for sharing that as well! Sent from my iPad On Nov 4, 2012, at 12:00 AM, "arun kirshna [via R]" wrote: > HI, > > I am not sure how you want your output. > Is it something like: > "WEBSITEWE

Re: [R] Replacing a string

2012-11-04 Thread R. Michael Weylandt
You want to read the ?regexp page and try gsub("^http://.*\\.com$";, "WEBSITE", ) Michael On Sun, Nov 4, 2012 at 4:09 AM, Allie818 wrote: > Hi, > > I have what I hope is a simple text processing question in R. > > I want to replace every instance of http:\\XXX.com with "WEBSITE" > > When I try

[R] Replacing a string

2012-11-04 Thread Allie818
Hi, I have what I hope is a simple text processing question in R. I want to replace every instance of http:\\XXX.com with "WEBSITE" When I try sub('(^http://)(.com$)', 'WEBSITE', );, it only substitutes http:// and .com so it looks like WEBSITEXXXWEBSITE How do I get it to match the pattern "