Substitute
-
sub
-
gsub
-
gsubis the global substituted or /g in other languages.
text = "ab text. and $ and ^ also"
puts text
puts text.sub(/\W/, "")
puts text.gsub(/\W/, "")
ab text. and $ and ^ also
ab text. and $ and ^ also
abtextandandalso