I want to validate a javascript string using regexp for URL.
I don’t wan’t to force http:// in the beginning.
What is the correct regexp, since I have the next one to include http:
var pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
If you want to use the regex you already have, but make ftp, http and https optional. See following: