Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nescalante/urlregex
URL validation for Node and the browser
https://github.com/nescalante/urlregex
Last synced: 20 days ago
JSON representation
URL validation for Node and the browser
- Host: GitHub
- URL: https://github.com/nescalante/urlregex
- Owner: nescalante
- License: mit
- Created: 2017-06-30T18:08:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T19:04:19.000Z (over 1 year ago)
- Last Synced: 2024-08-10T07:50:54.588Z (4 months ago)
- Language: JavaScript
- Size: 249 KB
- Stars: 6
- Watchers: 1
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: License
Awesome Lists containing this project
README
# urlregex
[![Greenkeeper badge](https://badges.greenkeeper.io/nescalante/urlregex.svg)](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` optionYou 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