Remove special word using gsub
Advertisements I try to clean some text and I would like to remove the following text from a string googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1513202928332-3’); }); For example, if x="123 googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1513202928332-3’); }); 456" then gsub("googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1513202928332-3’); });, ", x) The desired output is [1] 123456 Thank you >Solution : Regex approach You can use the… Read More Remove special word using gsub