Reputation: 3616
I have a huge string of multiple URLs in javascript which is of the following format:
var urls = "http://..... , http://..... , http://......"
I need to extract all URLs from the string into individual variables of part of an array. I cant do a urls.split(",") as some urls seem to have commas in them.Is there a good regex I can use to solve this problem ?
Upvotes: 0
Views: 397
Reputation: 12589
Split on a larger string: ", http://"
— that avoids the problem of commas in the middle of URLs.
Upvotes: 1
Reputation: 15063
Do you know for a fact that the URLs are separated by " , "? If so, split on that!
Upvotes: 0