input <- "this is my 'example'" change <- "\\1test" stringr::str_replace(input, "'[^']*'", paste0("'", change, "'")) gsub("'[^']*'", paste0("'", change, "'"), input)
Standard input is empty
Standard output is empty
Error in stri_replace_first_regex(string, pattern, fix_replacement(replacement), : Trying to access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Calls: <Anonymous> -> stri_replace_first_regex -> .Call Execution halted