0.1.7 • Published 2 years ago
text-regex v0.1.7
Install
NPM
$ npm i text-regex
Usage
check Email
var textRegex = require('text-regex');
textRegex.checkEmail('example@mail.com') // true
textRegex.checkEmail('foobar') // false
check Password
var textRegex = require('text-regex');
// 6-20 English uppercase and lowercase letters
// Must contain at least 1 number or special character
textRegex.checkPassword('password12^^') // true
textRegex.checkPassword('password') // false
check Date
var textRegex = require('text-regex');
textRegex.checkDate('2022-01-01') // true
textRegex.checkDate('foobar') // false
textRegex.checkDate('2022-1-1') // false
textRegex.checkDate('0000-01-01') // false
check URL
var textRegex = require('text-regex');
textRegex.checkUrl('https://bit.ly/3ukB4Za') // true
textRegex.checkUrl('http://example.com') // true
textRegex.checkUrl('example.com') // true
textRegex.checkUrl('foobar') // false
// https, http required
textRegex.checkUrlHaveHttp('https://example.com') // true
textRegex.checkUrlHaveHttp('http://example.com') // true
textRegex.checkUrlHaveHttp('example.com') // false
// https, http not required
textRegex.checkUrlNotProtocol('example.com') // true
textRegex.checkUrlNotProtocol('https://example.com') // false
textRegex.checkUrlNotProtocol('http://example.com') // false
// suport file,gopher,news,nntp,telnet,https,ftps,sftp
textRegex.checkUrlAdvance('sftp://example')
check Latitude, Longitude
var textRegex = require('text-regex');
// Latitude
textRegex.checkLatitude('37.532600')// true
textRegex.checkLatitude('37532600') // false
textRegex.checkLatitude('foobar') // false
// Longitude
textRegex.checkLongitude('127.024612') // true
textRegex.checkLongitude('foobar') // false
check Color Hex code
var textRegex = require('text-regex');
textRegex.checkHexcode('#ff4040') // true
textRegex.checkHexcode('ff4040') // true
check image
var textRegex = require('text-regex');
// check image is (png,jpg,gif)
textRegex.checkIsImageFile('image.jpg') // true
textRegex.checkIsImageFile('image') // false
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.13
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago