\’ means $’ which is everything after the match.
Escape the \ again and it works
"Yaho'o".gsub("'", "\\\\'")
More Related Contents:
- Best way to escape and unescape strings in Ruby?
- Ruby, Difference between exec, system and %x() or Backticks
- What is the difference or value of these block coding styles in Ruby?
- How to understand symbols in Ruby
- Look up all descendants of a class in Ruby
- “for” vs “each” in Ruby
- Mixing keyword with regular arguments in Ruby?
- String concatenation vs. interpolation in Ruby
- Block definition – difference between braces and do-end?
- When to use RSpec let()?
- How can I use Ruby to colorize the text output to a terminal? [closed]
- what’s different between each and collect method in Ruby [duplicate]
- How to create a file in Ruby
- Get names of all files from a folder with Ruby
- cannot load such file — zlib even after using rvm pkg install zlib
- In Ruby is there a way to overload the initialize constructor?
- Extract a substring from a string in Ruby using a regular expression
- How to get rid of non-ascii characters in ruby
- How do you use global variables or constant values in Ruby?
- Super keyword in Ruby
- Regex to split BBCode into pieces
- Really Cheap Command-Line Option Parsing in Ruby
- Running another ruby script from a ruby script
- How do I avoid trailing empty items being removed when splitting strings?
- How do I test a function with gets.chomp in it?
- Interpolating a string into a regex
- Overriding method by another defined in module
- Ruby gem for finding timezone of location [closed]
- Ruby local variable is undefined
- Understanding Ruby and OS I/O buffering