A Regular Expression to Validate HTTP URLs

# A Regular Expression to Validate HTTP URLs

Last updated:

Damn. There are so many versions of these on the internet that I thought I'd put my own version here so I can refer to it later on. This is the regular expression I'm using right now to validate URLs:

/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?\$/ix


I'll try to update this if I find out something better of if this turns out to work for my needs specifically.