Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在用另一种regex表达方式挣扎。我有:
regex
test <- "some.a, stuff.b, is.c, here.d, e, f, goaway.g" "some.a, stuff.b, is.c, here.d, e, f, goaway.g"
我想:
gsub("??", "", test) "a, b, c, d, e, f, g"
我不知道该为我的模式添加什么。我尝试了类似的东西"*\\.?",但没有用。我对正则表达式还不够熟悉,不知道我在做什么。
"*\\.?"
你可以试试
[az]+\.
如中,gsub("[a-z]+\\.", "", test)。
gsub("[a-z]+\\.", "", test)