0

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?

alexanoid
  • 24,051
  • 54
  • 210
  • 410
  • @Zenoo, yes but `www.medicare.co.uk` is valid – jhamon Mar 30 '18 at 15:13
  • @Andremoniy It is not the duplicate - I'm not going to validate the full input string for domain validity but I'd like to extract the domain from this string – alexanoid Mar 30 '18 at 15:16

0 Answers0