ruby remove character from string code example Example 1: ruby substring remove "hello".gsub(/[aeiou]/, '') Example 2: remove ascii characters from string ruby s.gsub!(/\P{ASCII}/, '')