In “How do I removing URLs from text?” the following code is suggested:
require 'uri'
#...
schemes_regex = /^(?:#{ URI.scheme_list.keys.join('|') })/i
#...
I tried to improve this to:
schemes_regex = Regexp.union(URI.scheme_list.keys)
but I can’t figure out how the IGNORECASE option (i) should be specified.
I don’t believe it’s possible to pass option arguments to
Regexp.unionlike that. You could of course specify them after the union operation: