ruby - When trying to escape apostrophe with 'gsub', I get backreference -
this question has answer here:
- why string#gsub double content? 3 answers
i have code:
"1'2".gsub("'","\\'")
instead of "1\'2"
, get: "122"
. why?
it because "\\'"
means context following match, "2"
.
Comments
Post a Comment