相关疑难解决方法(0)

如何使用grep()/ gsub()来查找完全匹配

string = c("apple", "apples", "applez")
grep("apple", string)
Run Code Online (Sandbox Code Playgroud)

这将为我提供所有三个元素的索引string.但我希望在单词"apple"上完全匹配(即我只想grep()返回索引1).

regex grep r word-boundary gsub

54
推荐指数
2
解决办法
7万
查看次数

标签 统计

grep ×1

gsub ×1

r ×1

regex ×1

word-boundary ×1