How to escape a backslash in R? [duplicate]
Solution 1:
I found a solution that works
str = gsub("([\\])","", str)
Solution 2:
Use Hmisc::escapeRegex
and Hmisc::escapeBS
which automatically escapes backslashes and other regex special characters.