Validation for feed links using by 'rss'

S

Swapna Ch

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
 
S

Swapna Ch

saurabh said:
Hi,
There are ways to validate url

1. validate using reg ex

/(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix

2. Ping the url using 'net/http'



--
Thanks and Regards
Saurabh Purnaye
+91-9922071155
skype: sorab_pune
yahoo & gtalk: saurabh.purnaye
msn: (e-mail address removed)


Thanx for replying
 
L

Lars Haugseth

* saurabh purnaye said:
[Note: parts of this message were removed to make it a legal post.]

Hi,
There are ways to validate url

1. 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top