I am trying to replace strings which start with a number inside a square bracket with a word.
[1]FirstWord!FF >> FirstReplace!!FF
[2]SecondWord!FF >> SecondReplace!!FF
This code only works if there is no [number] at the beginning.
'test!FF' %>% str_replace_all("test(['\"])?!","replace!")
But how can I update the pattern if I have something like below:
'[1]test!FF' %>% str_replace_all("[1]test(['\"])?!","replace!")