I am trying to substitute text to a word using gsub. For example:
My text is: I will add [USER=1234]@banana1[/USER] to the chat
My desired output is: I will add usermention to the chat
Basically , I want to substitute [USER=1234]@banana1[/USER] to usermention
I have tried the following code but unsuccessfully:
text=c("I will add [USER=1234]@banana1[/USER] to the chat")
replace_user=gsub("\\[user.*?\\/user\\]","usermention",text)