Probably simpler to use `URI.regexp` here.

```ruby
  requested_cask =~ URI.regexp
```