我有一个页面,可以从中获取如下链接:
var urls = "http://domain.com/example?p=123https://domain2.com/example?p=123..."
What I want is to separate them in Javascript/jQuery and like get an array, I tried with .slice() and more but didn't find any solution...
Example: urls[0] -------- // Should echo "http://domain.com/example?p=123"
urls[1] -------- // Should echo "https://domain2.com/example?p=123..."
不幸的是我无法访问服务器...谢谢:)
最佳答案
var urls = "http://domain.com/example?p=123https://domain2.com/example?p=123..."; urls.replace(/(https+:)/, '%%%$1').split('%%%');
正确答案来自@Teemu
关于javascript - Javascript 中的单独 url/链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33529191/