Created
October 29, 2019 19:25
-
-
Save ahgood/085f7052acc88cfae324955dc3dcde04 to your computer and use it in GitHub Desktop.
Extract URLs from content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regxURL = new RegExp(`(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])`, 'igm'); | |
const content = 'Hello www.google.com World http://yahoo.com'; | |
const urls = content.match(regxURL); // ["www.google.com", "http://yahoo.com"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment