[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Validation for feed links using by 'rss'
From: Lars Haugseth <njus () larshaugseth ! com>
Date: 2010-05-31 9:25:07
Message-ID: 857hmke7vb.fsf () shell ! tindetech ! no
[Download RAW message or body]
* saurabh purnaye <saurabh.purnaye@gmail.com> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic