Validation for feed links using by 'rss'

Discussion in 'Ruby' started by Swapna Ch, May 21, 2010.

  1. Swapna Ch

    Swapna Ch Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
     
    Swapna Ch, May 21, 2010
    #1
    1. Advertising

  2. Swapna Ch

    Swapna Ch Guest

    saurabh purnaye wrote:
    > 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:
    > --
    > please don't print this e-mail unless you really need to.



    Thanx for replying
    --
    Posted via http://www.ruby-forum.com/.
     
    Swapna Ch, May 22, 2010
    #2
    1. Advertising

  3. * saurabh purnaye <> wrote:
    >
    > [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

    --
    Lars Haugseth
     
    Lars Haugseth, May 31, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    773
    SpaceGirl
    Feb 25, 2005
  2. Motta
    Replies:
    1
    Views:
    535
    Andy Dingley
    Jun 9, 2004
  3. Jason James
    Replies:
    3
    Views:
    338
    Jason James
    May 12, 2006
  4. Scott Gordo
    Replies:
    5
    Views:
    711
  5. Jonathan Groll
    Replies:
    1
    Views:
    280
    Kouhei Sutou
    Jun 27, 2009
Loading...

Share This Page