How can ruby do this task (Case-insensitive string search & replace in Ruby)?
replace, ruby, string
Solution
If I understood you correctly this is what you want to do:
puts "What the human does is not like what animal does.".gsub(/(what)/i, '==\1==')
which will output
==What== the human does is not like ==what== animal does.
Problem
I have some problem with replace string in Ruby. My Original string : What the human does is not like what animal does. I want to replace to: ==What== the human does is not like ==what== animal does. I face the problem of case sensitive when using gsub. (eg. What , what) I want to keep original text. any solution?