Use regex and string.gsub()
2.0.0-p643 :004 > "xxxxxxx#code#xxxxxxxx".gsub(/\#code#/i, "#NEWCODE#")
=> "xxxxxxx#NEWCODE#xxxxxxxx"
solved How to replace special text in a string in Ruby? [closed]
Use regex and string.gsub()
2.0.0-p643 :004 > "xxxxxxx#code#xxxxxxxx".gsub(/\#code#/i, "#NEWCODE#")
=> "xxxxxxx#NEWCODE#xxxxxxxx"
solved How to replace special text in a string in Ruby? [closed]