javascript - Get only domain from any URL -
my goal these urls:
https://www.facebook.com/ -> https://www.facebook.com/ http://www.facebook.com/ -> http://www.facebook.com/ https://www.facebook.com -> https://www.facebook.com https://www.facebook.com/awdawdaw/dawdwad -> https://www.facebook.com/ my regex is: /(https*:\/\/.+(\/|\b))/gi.
first 3 urls been returned well. when there after / character, match characters , don't want it. should next?
Comments
Post a Comment