Check out example codes for "ruby remove unsafe file characters". It will help you in understanding the concepts better.

Code Example 1

str.gsub(/[^0-9A-Za-z]/, '')

Learn ReactJs, React Native from akashmittal.com