Intelligently finds many different url formats in a string. For the browser and node.
Intelligently finds many different url formats in a string. For the browser and node.
## About
## About
In a nutshell, `my-name-is-url` is an intelligent parser that searches a string of text for urls. The url spec is so vague that almost anything _could_ be a url. The regular expression used in `my-name-is-url` tries to match patterns likely to represent a url in a sentence rather than matching the actual url spec.
In a nutshell, `my-name-is-url` is an intelligent parser that searches a string of text for urls. The url spec is so vague that almost anything _could_ be a url. The regular expression used in `my-name-is-url` tries to match patterns likely to represent a url in a sentence rather than matching the actual url spec.
> ❗️**Important note**
> ❗️**Important note**
@ -9,34 +11,43 @@ In a nutshell, `my-name-is-url` is an intelligent parser that searches a string
> If you're trying to parse a url into sections (scheme,host) or check a url is valid this module isn't for you. This module is intended to find urls in a string.
> If you're trying to parse a url into sections (scheme,host) or check a url is valid this module isn't for you. This module is intended to find urls in a string.
## Install
## Install
```shell
```shell
$ npm install --save my-name-is-url
$ npm install --save my-name-is-url
```
```
or
or
```shell
```shell
$ jspm install npm:my-name-is-url
$ jspm install npm:my-name-is-url
```
```
## Usage
## Usage
Import the module
Import the module
#### CommonJS
#### CommonJS
```js
```js
var Urls = require('my-name-is-url');
var Urls = require('my-name-is-url');
```
```
#### ES6
#### ES6
```js
```js
import Urls from 'my-name-is-url';
import Urls from 'my-name-is-url';
```
```
### Regex
### Regex
If you just wanna do your own thing the regex used internally is helpfully exposed
If you just wanna do your own thing the regex used internally is helpfully exposed
```js
```js
const UrlRegex = Urls.regex;
const UrlRegex = Urls.regex;
```
```
### Get Urls
### Get Urls
The `get()` method returns an array of urls in a string
The `get()` method returns an array of urls in a string
```js
```js
@ -48,6 +59,7 @@ Urls(text).get(); // Returns:
```
```
### Filter Urls
### Filter Urls
The `filter()` method runs a filter on each url in a string
The `filter()` method runs a filter on each url in a string