I don't understand what is going on here. How should I feed gsub to get the string "Yaho'o"?
>> "Yaho'o".gsub("Y", "\Y") => "\Yaho'o" >> "Yaho'o".gsub("'", "\'") => "Yahooo"
' means $' which is everything after the match. Escape the again and it works
"Yaho'o".gsub("'", "\\'")
1.4m articles
1.4m replys
5 comments
57.0k users