【发布时间】:2018-08-21 22:07:30
【问题描述】:
我正在尝试从 R 中的字符串开头删除主题标签。 例如:
x<- "I didn't know it could be #boring. guess I need some fun #movie #lateNightThoughts"
我想删除字符串末尾的 #lateNightThoughts 和 #movie 主题标签。结果:
- "I didn't know it could be #boring. guess I need some fun"
我试过了:
stringi::stri_replace_last_regex(x,'#\\S+',"")
但它只删除最后一个标签。
- "I didn't know it could be #boring. guess I need some fun #movie "
知道如何获得预期的结果吗?
编辑:
如何从文本开头删除主题标签? 例如:
x<- "#Thomas20 I didn't know it could be #boring. guess I need some fun #movie #lateNightThoughts"
【问题讨论】: