I use the following regex which extracts domain names and urls with/without schema and www
:
(https?://)?\w+(\.\w+)+(/\w+)*(/\w+\.\w+)?(\?[\w%&=.]*)*(?=[^\w.?&%=])
that works fine in most of the cases, for example for www.medicare.gov
But it doesn't work in case of input text www.medicare.gov.
How to fix it in order to support such or similar cases also?