1.0.0 • Published 6 years ago

js-validation-regex v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Validation RegEx for Node.js and Javascript

This library provides regular expression (RegEx) patterns for validation of:

KeyDescription
mobileMobile no. in India (only ten digits without 0 or country code). Eg - 9xxxxxxxxx
landlineLandline no. in India (landline number with STD code, no hypens or spaces). Eg - 0204xxxxxxx
namePerson's name (only uppercase & lowercase letters/characters and space allowed)
pincodePincode/Zipcodes in India
panPAN no. in India
aadhaarAADHAAR no. in India (12 digits with no space allowed in between)
filenameFile names (Only letters, digits, '-', '_', '.' are allowed. Spaces allowed only in middle and not at the start or end)
pathURL's or paths (Only letters, digits, '-', '_', '.', '/' are allowed)
floatFloating point numbers
dateStringDate with format = YYYY-MM-DD
charactersOnlyOnly uppercase and lowercase letters
alphanumericOnly digits and uppercase & lowercase letters
asciiOnly ASCII characters
stringStrings
addressAddress input fields
gstinGSTIN no. of businesses in India
drivingLicenceDriving Licence no. in India (no spaces and hypens allowed)
vehicleRegistrationNumberVehicle Registration no. in India (no spaces and hypens allowed)

How to use?

// Node.js or non ES6
const validationRegex = require('@eumentis-cloud/js-validation-regex');
// ES6
import validationRegex from '@eumentis-cloud/js-validation-regex';

const valueToValidate;
// Replace <key> with any key (mentioned in table above) that you want to use
validationRegex.<key>.test(valueToValidate);  // true of false