https://github.com/gamote/goturl
The library that tries to do its best to extract urls from strings.
https://github.com/gamote/goturl
Last synced: 7 months ago
JSON representation
The library that tries to do its best to extract urls from strings.
- Host: GitHub
- URL: https://github.com/gamote/goturl
- Owner: Gamote
- Created: 2023-12-18T13:27:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-26T11:49:39.000Z (over 2 years ago)
- Last Synced: 2025-01-29T07:47:50.066Z (over 1 year ago)
- Language: TypeScript
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# goturl
[](https://www.npmjs.com/package/goturl)
[](https://www.npmjs.com/package/goturl)

**goturl** - the library that tries to do its best to extract urls from strings.
## Installation
```bash
yarn add goturl
```
## Usage
```ts
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
```bash
yarn test
```