javascript - Regular matching of whether the URL starts with double slashes + whether it contains a domain name + whether it contains a protocol
ringa_lee
ringa_lee 2017-05-19 10:30:41
0
1
543

For example, I have four path conditions like this
'//img.xxx.com.cn/IKxOJF/qy_6/xm_22/20170426/e1475eedc6ff7dada35af3b8306f0a63.png';
'/IKxOJF/qy_6/xm_22/20170426 /e1475eedc6ff7dada35af3b8306f0a63.png';
'http://img.xxx.com.cn/IKxOJF/...';
'https://img.xxx.com.cn/IKxOJF...'
The first one starts with double slashes, and then it needs to automatically complete 'http:' or 'https:';
The second one needs to automatically complete the domain name http://img.xxx.com.cn ;
The third and fourth types are not operated.
How to write a regular pattern for such a match?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
Ty80
/^\/\//.test(str)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template