Url validation regex

I have found a pretty good regex expression for urls but it doesnt account for any variation of upper case www or https. Could someone show me how to modify it please.

(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})

I use :lowercase in when saving just for website but I can’t use that for this scenario, it’s complicated.

This topic was automatically closed after 70 days. New replies are no longer allowed.