0

I have string

a <- c("COC1=CC(\\C=C\\C(=O)CC(=O)\\C=C\\C2=CC=C(O)C(OC)=C2)=CC=C1O")

I want to remove single backslash. I am expecting following result

COC1=CC(\C=C\C(=O)CC(=O)\C=C\C2=CC=C(O)C(OC)=C2)=CC=C1O
mr_swap
  • 339
  • 1
  • 2
  • 10
  • The backslashes are escaped characters. Similar to how `\t` is a single character denoting a TAB, `\\` is a single character denoting a backslash. If you remove one of the backslashes, you will then have a bunch of single characters `\C`, which will create an error as an unrecognized escape character. – Benjamin Sep 18 '17 at 15:24
  • 'cat' is for print, right? – mr_swap Sep 18 '17 at 15:25
  • @d.b this link explains how to gsub double backslash by forward slash. What I want is how to gsub double backslash by single backslash – mr_swap Sep 18 '17 at 15:31
  • 1
    There are no double backslashes in your string. Hint: don't believe what's printed. – Hong Ooi Sep 18 '17 at 15:35
  • @ Hong Ooi thanks that was very helpful – mr_swap Sep 18 '17 at 15:37

0 Answers0