goturl
v3.6.19
Published
The library that tries to do its best to extract urls from strings.
Downloads
1,775
Maintainers
Readme
goturl
goturl - the library that tries to do its best to extract urls from strings.
Installation
yarn add goturl
Usage
import { extractUrl } from 'goturl';
extractUrl("Visit https://example.com for more info");
// => https://example.com
extractUrl("Website: another-one.com");
// => another-one.com
extractUrl("Don't forget about this.com/thing?query=string", { fallbackProtocol: 'https' });
// => https://this.com/thing?query=string
extractUrl("Check out our promotions: http://promotion.com http://promotion.com/real/offer", { getLongestUrl: true });
// => http://promotion.com/real/offer
extractUrl("Quick reminder, check out our websitehttps://hurry.com/mistake", { tryFixProtocol: true });
// => https://hurry.com/mistake
Testing
yarn test