I got this error when using this regex:

"/^((http|https):\/\/)?(www.)?([a-z0-9-]+\.)+[a-z]{2,6}$/"

I have made this regex to validate urls so i can allow htttp://site.com or www.site.com etc.

Any suggestions to improve it are welcome.