【发布时间】:2022-12-01 20:19:30
【问题描述】:
I would like to replace the captured group from my regex with XXX(captured group), but it is only replacing it with XXX and deleting the word captured by the regex.
search <- "[a-z]{5,}"
gsub((search), "xxx\\1", texts$text)
If the word: "wonderful" is matched by the regex, I would have wanted to replace it with "XXXwonderful", but I only got "XXX"
【问题讨论】:
标签: r regex replace gsub capture-group