7.2.0 • Published 6 years ago
@gerhardsletten/get-urls v7.2.0
get-urls
Get all URLs in a string
The URLs will be normalized.
Install
$ npm install get-urls
Usage
const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';
getUrls(text);
//=> Set {'http://sindresorhus.com', 'http://yeoman.io'}
API
getUrls(text, options)
Returns a Set
of URLs.
text
Type: string
options
Type: Object
All the normalize-url
options in addition to:
extractFromQueryString
Type: boolean
Default: false
Extract URLs that appear as query parameters in the found URLs.
Related
- get-urls-cli - CLI for this module
- linkify-urls - Linkify URLs in text
- url-regex - Regular expression for matching URLs
License
MIT © Sindre Sorhus
7.2.0
6 years ago