# Replace first value a return new string sentence = 'pop poper' sentence.sub('pop', 'stop') => 'stop poper' puts sentence => 'pop poper' # Replace all matches and return new string sentence = 'pop poper' sentence.gsub('pop', 'stop') => 'stop stoper' puts sentence => 'pop poper' # Replace first value and update existing string sentence = 'pop poper' sentence.sub!('pop', 'stop') => 'stop poper' puts sentence => 'stop poper' # Replace all matches and update string sentence = 'pop poper' sentence.gsub!('pop', 'stop') => 'stop stoper' puts sentence => 'stop stoper' user_input = "mooventhan" user_input.gsub!(/moo/, "hel") print user_inputmyString = "Welcome to JavaScript!" myString["JavaScript"]= "Ruby" puts myString => "Welcome to Ruby!"