A
A
abonu2017-10-20 19:18:49
JavaScript
abonu, 2017-10-20 19:18:49

Get or parse URLs (links) from an arbitrary string in Node.js?

Hello!
Tell me, please, how can I get an array of links (URL) included in it from an arbitrary string in Node.js?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2017-10-20
@abonu

Use sindresorhus/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'}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question