I have a line
text = "Math\n \n \n 600 rubles / 45 min."
text2 = "Math\n \n \n in a group"
And I want to replace \n \n \nwith " "only in the case of the following digits. As a result, I want to have:
"Math 600 rubles / 45 min."
"Math\n \n \n in a group"
I tried gsub("\n \n \n [\\d]", " ", text), but it also replaces the first digit.
source
share