hd-utils
Version:
A handy utils for modern JS developers
9 lines (8 loc) • 328 B
JavaScript
import { urlRegexForLongStr } from "../../regex/index";
/**
* @description will extract all urls from a long string and return a list of the urls.
* @example "Hello, visit me at www.example.com!" => ["www.example.com"]
*/
export default function extractUrlsFromString(str) {
return str.match(urlRegexForLongStr) || [];
}