On Mon, Sep 28, 2009 at 1:11 PM, Rob Biedenharn
<Rob / agileconsultingllc.com> wrote:
> On Sep 27, 2009, at 11:48 PM, Hunt Jon wrote:
>
>> Hi - I'm working on the script below, which attempts at getting
>> a user input and validate that the input is formed like a URL.
>> And if the user fails to input, it should ask again.
>>
>> require 'uri'
>> puts "Type a URL"
>> begin
>>   
>>  ɮ    
>> rescue URI::InvalidURIError
>>   ̮ >>  
>> end
>>
>> I expect that if I run "URI.parse()" it should raise an error, but
>> it doesn't happen.
>>
>> Can anybody help me on this one?
>>
>> Jon
>
> require 'uri'
> print "Type a URL: "
> begin
>   
>   >   ɮ     
>  > rescue URI::InvalidURIError
>   ̮ >  
> end
>
> Try getting a little bit more information out (and post what input you are
> trying that you expect to be malformed).
>
> Note that some URI's are HTTP and some might be Generic.   > more types of URI that just those that start with http://.  
> seen a jdbc resource string?
>
> -Rob

I expect a user to input a HTTP or HTTPS URL. e.g., http://abcdef.gov
Maybe using URI seems *too* generic after the research as 'uri' means
different protocols, not just http/https.

I'll look into it. Perhaps using Regexp match would be better.

Jon