Socket
Socket
Sign inDemoInstall

jscommonregex

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jscommonregex

A node.js package for common regular expressions.


Version published
Maintainers
1
Install size
13.6 kB
Created

Readme

Source

node-common-regex

A Node.js package that exports functions to validate various types of data using regular expressions.

Installation

npm install jscommonregex

Usage

import {
  IsInt,
  IsPositiveInt,
  IsDecimalNum,
  IsNum,
  IsAlphaNumeric,
  IsAlphaNumericWithSpace,
  IsEmail,
  IsGoodPassword,
  IsUsername,
  IsURL,
  IsIPv4,
  IsIPv6,
} from "jscommonregex";

console.log(IsInt(10)); // true
console.log(IsInt("10")); // false
console.log(IsPositiveInt("10")); // true
console.log(IsDecimalNum("10.2")); // true
console.log(IsNum("10.2")); // true
console.log(IsNum("-10.2")); // true
console.log(IsAlphaNumeric("hello123")); // true
console.log(IsAlphaNumericWithSpace("hello 123")); // true
console.log(IsEmail("example@email.com")); // true
console.log(IsGoodPassword("Abcdefg1@")); // true
console.log(IsUsername("john_doe")); // true
console.log(IsURL("https://www.example.com")); // true
console.log(IsIPv4("192.168.0.1")); // true
console.log(IsIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334")); // true

License

MIT

Note

Please note that these regular expressions are not foolproof and might not cover all possible cases. They are meant to be used as a basic validation tool and not as a definitive solution.

Keywords

FAQs

Last updated on 25 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc