Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/basemax/url-validator-nodejs
This is a simple module for validating urls in nodejs and javascript that help you to extract urls from a text, check if a text has a url, check if a text has a specific url, and check if a text is excatly a url.
https://github.com/basemax/url-validator-nodejs
javascript js nodejs regex regular-expression regular-expression-parser regular-expressions url-validate url-validator validate validator
Last synced: 1 day ago
JSON representation
This is a simple module for validating urls in nodejs and javascript that help you to extract urls from a text, check if a text has a url, check if a text has a specific url, and check if a text is excatly a url.
- Host: GitHub
- URL: https://github.com/basemax/url-validator-nodejs
- Owner: BaseMax
- License: gpl-3.0
- Created: 2023-04-09T13:13:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-09T18:17:06.000Z (almost 2 years ago)
- Last Synced: 2025-02-04T07:15:42.653Z (6 days ago)
- Topics: javascript, js, nodejs, regex, regular-expression, regular-expression-parser, regular-expressions, url-validate, url-validator, validate, validator
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# url-validator-nodejs
This is a simple module for validating urls in nodejs and javascript that help you to extract urls from a text, check if a text has a url, check if a text has a specific url, and check if a text is excatly a url.
## Features
- Extract all urls from a text
- Check if a text has a url
- Check if a text has a specific url
- Check if a text is excatly a url## Using
Import the module:
```javascript
const url_validator = require("./url-validator");
```Then you can extract all urls from a text:
```javascript
console.log(url_validator.match("https://google.com/first/second/third and site.com/test"));
```Or you can check if a text has a url:
```javascript
console.log(url_validator.has("1 https://google.com/first/second/third 2"));
```Or you want to check your input is excatly a url:
```javascript
console.log(url_validator.exact("!!!!"));
console.log(url_validator.exact("https://google.com/first/second/third"));
```Or you can check if a text has a specific url:
```javascript
console.log(url_validator.includes("first https://google.com/first/second/third second google.com sallam.org bye.net", "https://google.com/first/second/third"));
console.log(url_validator.includes("first https://google.com/first/second/third second google.com sallam.org bye.net", "bye.net"));
console.log(url_validator.includes("first https://google.com/first/second/third second google.com sallam.org bye.net", "xxxxxxxxxxxx.net"));
```Copyright 2023, Max Base