I have this code:
"1'2".gsub("'","\\'")
Instead of "1\'2", I get: "122". Why?
"1\'2"
"122"
It is because "\\'" means the context following the match, which is "2".
"\\'"
"2"