Skip to content

This validation function will validate Regex numeric, alphaonly, alphanumeric, alphanumericwithspecialchar, email

Notifications You must be signed in to change notification settings

AritraDB/regex-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

regex-validation

This validation function will validate Regex numeric, alphaonly, alphanumeric, alphanumericwithspecialchar, email

Install

npm i regex-validation

Parameters

It'll accept two parameters-
1. Original Data
2. Validation Type

Return Type

It'll return a boolean.

Parameters Data Type Mandatory Description
Original Data string Yes Need to send value, which needs to be validated
Validation Type string Yes Need to send type of validation (numeric, alpha-numeric, alphabets-with-space)

Implementation Guideline

Import the package from:
const validateRegexData= require('regex-validation') or import validateRegexData from 'regex-validation';
Use the function:
console.log(validateRegexData("123E45","numeric"))

Realtime Examples

Use case # 1:
Requirement:
If the original data is 123E45 (which you want numeric regex validation)
Use:
validateRegexData("123E45","numeric");
Output:
false.

Use case # 2:
Requirement:
If the original data is 123E45 (which you want alpha-numeric regex validation)
Use:
validateRegexData("123E45","alpha-numeric");
Output:
true.

Use case # 3:
Requirement:
If the original data is Demo Data (which you want alphabets-with-space regex validation)
Use:
validateRegexData("Demo Data","alphabets-with-space");
Output:
true.

Version History

1.0.0

Actual code and documentation published

Upcoming Updates

1.0.1

Others regex validation type will be added

About

This validation function will validate Regex numeric, alphaonly, alphanumeric, alphanumericwithspecialchar, email

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published