In my rail application, I need to verify whether the URL given by the user is really a URL. I only use the HTTP protocol (And possibly HTTPS, I have not paid any attention to it at all), which makes me believe that there may be something in the train already that can work for me.
If not: Can you recommend a regex string? I have found something after googling but all of them have one or two problems according to user comments.
Thanks
def uri? (String) Yuri = URI String (string)% w (http https) .include? (Uri.scheme) Rescue URI :: Evil Error False URI :: Invalid URIA RRF Last This is a very simple example. The advantage of using the URI library on regular expressions is that you can do complex tests.
Comments
Post a Comment