1.1.7 • Published 9 months ago

kv-regexp-validation v1.1.7

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

kv-regexp-validation

Introduction

JavaScript library provides user to custom their regex validation.

Installation

npm install kv-regexp-validation

Usage

const regxValidator = require('kv-regexp-validation');
      regxValidator.RegexCSTValidator(String,[option]);
      regxValidator.RegexEMValidator(String);
      regxValidator.RegexSTRCaseValidator(caseString,String);

RegexCSTValidator is a flexible tool designed to validate strings using regular expressions, and it offers the ability to customize the validation process by providing an optional second argument. This second argument allows users to define specific regex conditions tailored to their validation needs, enabling them to control the level of validation complexity or specificity as required.

RegexEMValidator is ability to validate emails.

RegexSTRCaseValidator is match whole word with case.Passed the case string to the first argument and passed the second argument as a string for validate with case string.

Configuration options

RegexCSTValidator Below are the default values for the configuration parameter.

       [{
        min:1,
        max:1,
        leastOneletter:false,
        leastOneNumber:false,
        leastOnecharacter:false,
        leastOneLowerCaseletter:false,
        leastOneUpperCaseletter:false,
        leastOneSpecialcharacter:false
        
        }]

Examples

const regxValidator = require('kv-regexp-validation');

// Customize  strings using given conditions
let customizeString = regxValidator.RegexCSTValidator("ex1",[ {
    min:1,
    max:4,
    leastOneletter:true,
    leastOneNumber:true,
    leastOnecharacter: false,
    leastOneLowerCaseletter:false,
    leastOneUpperCaseletter:false,
    leastOneSpecialcharacter:false

}]);

console.log(customizeString) //true

// Validate email 
let validateEmail = regxValidator.RegexEMValidator("admin@gmail.com");

console.log(validateEmail)  //true

// Validate whole String with Case .
let example_1= 'https://example.com/Template/Edit/'
let example_2= 'https://example.com/TemplateChapter/Edit/1ddae88c-55dc-484c-adbcf'

let caseValidate_ex1 =regxValidator.RegexSTRCaseValidator("Template",example_1)
let caseValidate_ex2 =regxValidator.RegexSTRCaseValidator("Template",example_2)

console.log(caseValidate_ex1) //true
console.log(caseValidate_ex2); //false because match with whole case 'Template'

Contribute

If you would like to contribute ,Clone repository and open pull request.

1.1.7

9 months ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago