Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including get-urls with all npm packages installed. Try it out:

var getUrls = require("get-urls")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

get-urls v9.2.0

Get all URLs in a string

get-urls Build Status

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, // consectetuer adipiscing elit.';

//=> Set {'', ''}


getUrls(text, options?)

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.


Type: boolean
Default: true

Require URLs to have a scheme or leading www. to be considered an URL. When false, matches against a list of valid TLDs, so it will match URLs like

Does not affect URLs in query parameters if using the extractFromQueryString option.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free