add site url validation regex

Solutions on MaxInterview for add site url validation regex by the best coders in the world

showing results for - "add site url validation regex"
Nico
12 Jan 2019
1const regex = /^((ftp|http|https):\/\/)?(www.)?(?!.*(ftp|http|https|www.))[a-zA-Z0-9_-]+(\.[a-zA-Z]+)+((\/)[\w#]+)*(\/\w+\?[a-zA-Z0-9_]+=\w+(&[a-zA-Z0-9_]+=\w+)*)?$/gm;
2const str = `http://www.sample.com
3https://www.sample.com
4http://www.sample.com/xyz
5www.sample.com
6www.sample.com/xyz/#/xyz
7sample.com
8www.sample.com
9mofiz.com
10kolim.com
11www.murikhao.www.sample.com
12http://murihao.www.sample.com
13http://www.sample.com/xyz?abc=dkd&p=q&c=2
14www.sample.gov.bd
15www.sample.com.en
16www.sample.vu
17
18
19`;
20let m;
21
22while ((m = regex.exec(str)) !== null) {
23
24    if (m.index === regex.lastIndex) {
25        regex.lastIndex++;
26    }
27    console.log("matched :"+m[0]);
28}
queries leading to this page
web url vaslidation regexregex url validation including localhostregex validate urlvalidate url regexwebsite url validation regex javascriptregex for valid web addressbest url validation regexregex website url validationregex link validationregex for website urlhttp url validation regexhow to validate pattern url of httpssimple url validation regexurl validation regex javascripturl with http validation regex javascriptproper regex website url validationwebsite validation regexregexp url validationjavascript url validation regexregex pattern for url validationregex url validationwebsite url regexurl validation regexvalidate url using regexregex to validate urlurl valid regexregex site urlregex to validade a urlvalid url string regexregexp full url validationbest url validator regexregex for validating urlregex for website url validation jsregex for url validation javascriptregex validation linksis valid url regezregex validation for website urlurl validation using regexregular expression url validationregex valid urlvalid website url regex jsregex for url validationregex validation urlurl validator regexurl valid characters regexurl regex validationregex expression for url validationurl validation regex inputurl validation regex in javascriptvalidate url udsing regular expressionbasic url validation regexregex url validation simplevalid url regexurl validation regesvalidate url html regexregex for website url validationregex validate url without httpvalid url with www regexregular expression validation website urlregex website validationwebsite url validation regexpattern validation for websiteurl regex validation javascriptadd site url validation regex