validating the url using the rails code example Example: rails check if a URL is valid require 'uri' url =~ URI::regexp # => 0 if it match, nil if not