urlregex
Version:
URL validation for Node and the browser
30 lines (18 loc) • 671 B
Markdown
# urlregex
[](https://greenkeeper.io/)
No-dependency URL validation for Node and the browser.
## Install
```
npm install urlregex
```
## Usage
```js
const urlRegex = require('urlregex');
const isValid = urlRegex().test('http://github.com');
```
### `allowedProtocols` option
You can provide the `allowedProtocols` option to specify which protocols are allowed in the URL. It can either be an array of strings or the `'*'` wildcard to allow any protocol.
## Credits
Mostly based on [url-regex package](https://github.com/kevva/url-regex), but optimized for browser usage
## License
MIT