[R] Replacing a string

Allie818 alice.ly at gmail.com
Sun Nov 4 05:09:38 CET 2012


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', <filename>);,
it only substitutes http:// and .com so it looks like 
WEBSITEXXXWEBSITE

How do I get it to match the pattern
"http:// . . . . .com" and substitute the whole phrase?

Thanks in advance!



--
View this message in context: http://r.789695.n4.nabble.com/Replacing-a-string-tp4648368.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list