从字符串中删除特定标签-R

时间:2019-05-24 14:06:23

标签: r string tags

我阅读了类似的问题并将其应用于我的案子,但是它们没有用。无论如何,如何从字符串中删除<\/p>\r\n<p>? 我的尝试失败:

string <- "Hello!<\/p>\r\n<p>For this skill, I had no idea of what to do at first."
gsub("<\/p>\r\n<p>","",string)
gsub("<\\/p>\\r\\n<p>","",string)

谢谢

1 个答案:

答案 0 :(得分:0)

我使用以下代码解决了

string <- gsub("<[^>]+>", "", string)
string <- gsub("\\r\\n", "", string,fixed=TRUE)
相关问题