1.0.4 • Published 4 years ago

easy-regexp_lib v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

easy-regexp_lib

it is a library to use regular expression in javascript easier.

Install

npm i easy-regexp_lib

Usage

import regExpLib from "easy-regexp_lib";

let test = regExpLib('a').then(['a',"b","c"],1).test();  //array['a',"b","c"] has element "a",so return true;
let test2 = regExpLib('a').then(['v',"d","e"],1).test();  //['v',"d","e"] doesn't include element "a",so return false;

Event

1. then(array,int)

to set the conditions for regular expressions

regExpLib(inputString).then(conditionArray1,1).then(conditionArray2,2);//The first character have to include 
//conditionArray1, the second and third characters have to include conditionArray2

2. test()

retrun whether the inputStr correspond the condition(true or false)

regExpLib("1234").then([1],1).then([2,3,4],3).test();//return true;

3. replace(string)

Turn the non-correspond part into string

regExpLib("1234").then([1],1).then([2,3],3).replace(0);//return "1230"