问题
What is the Regex to match any character repeated three or more times in R (e.g. "aaargh", "arrrrrgh", "yesssssss")? I read the solution for Python, PHP and PCRE on Stack Overflow, but they don't seem to be applicable to R. Thanks.
回答1:
We can use grep
grep("(.)\\1{2,}", v1)
data
v1 <- c("aaargh", "arrrrrgh", "yesssssss")
来源:https://stackoverflow.com/questions/38263441/regex-to-match-any-character-repeated-three-or-more-times-in-r