Regex for URL validation

Hello, I have this Regex for my url validation:

return /^(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(url);

To this I would like to add the option to let the user insert url’s like: or
So basically allow after the last dot, text of any kind. I guess this would also work for: .London, .Berlin etc.
I am just confused how regex is built, so not sure to which part I need to add what to allow my above url’s. Thanks.

1 Like

Thanks. It was usefully :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.