Hi all,
I used require ‘rss’.
got the feeds in links what i gave in the link field.
but i want to validate the link is corect url/uri or not.
Please reply to me
Hi all,
I used require ‘rss’.
got the feeds in links what i gave in the link field.
but i want to validate the link is corect url/uri or not.
Please reply to me
Hi,
There are ways to validate url
/(^$)|(^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+).[a-z]{2,5}(([0-9]{1,5})?/.)?$)/ix
please don’t print this e-mail unless you really need to.
saurabh purnaye wrote:
Hi,
There are ways to validate url
- validate using reg ex
/(^$)|(^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+).[a-z]{2,5}(([0-9]{1,5})?/.)?$)/ix
- Ping the url using ‘net/http’
–
Thanks and Regards
Saurabh P.
+91-9922071155
skype: sorab_pune
yahoo & gtalk: saurabh.purnaye
msn: [email protected]please don’t print this e-mail unless you really need to.
Thanx for replying
[Note: parts of this message were removed to make it a legal post.]
Hi,
There are ways to validate url
- validate using reg ex
/(^$)|(^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+).[a-z]{2,5}(([0-9]{1,5})?/.)?$)/ix
Why not use the standard library?
require ‘uri’
begin
uri = URI.parse(url_string)
rescue URI::InvalidURIError
puts “Bad URL: #{url_string}”
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs