Get all URLs in a string
The URLs will be normalized.
Don't use this for any kind of security-related validation.
$ npm install get-urls
const getUrls = require('get-urls');
const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';
getUrls(text);
//=> Set {'http://sindresorhus.com', 'http://yeoman.io'}
Returns a Set
of URLs.
Type: string
Type: Object
All the normalize-url
options in addition to:
Type: boolean
Default: false
Extract URLs that appear as query parameters in the found URLs.
Type: string[]
Default: []
Exclude URLs that match URLs in the given array.
- get-urls-cli - CLI for this module
- linkify-urls - Linkify URLs in text
- url-regex - Regular expression for matching URLs
MIT © Sindre Sorhus