I know this question has been asked multiple times in different ways, but I can't find a solution where I would replace the text between some "borders" while keeping the borders.
input <- "this is my 'example'"
change <- "test"
And now I want to replace everything between teh single quotes with the value in change
.
Expected output would be "this is my 'test'
I tried different variants of:
stringr::str_replace(input, "['].*", change)
But it doesn't work. E.g. the one above gives "this is my test"
, so it doesn't have the single quotes anymore.
Any ideas?