【发布时间】:2023-02-07 03:22:09
【问题描述】:
我试图在我的脚本有 2 个或更多个连续滴答时删除任何时间。我从here 了解到,使用正则表达式可以检测到任何带有 (.)\1 的重复字符,因此我将其修改为 (`)\1,但这不起作用。为什么不?
library(stringr)
example <- c("``", "````", "`")
str_replace_all(example, "(`)\1", "gone") #want the first 2 to say 'gone' and the 3rd to stay the same
【问题讨论】: