@hugoalh/repattern

A module to provide regular expression pattern.

Usage no npm install needed!

<script type="module">
  import hugoalhRepattern from 'https://cdn.skypack.dev/@hugoalh/repattern';
</script>

README

REPattern (NodeJS)

REPattern.NodeJS GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade LGTM Alerts LGTM Grade License

Release Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

📝 Description

A NodeJS module to provide regular expression pattern.

🌟 Feature

  • Customizable flags
  • Include standard named capture groups (and configable)

Pattern

Legend Description
Include standard named capture groups (and configable).
  • base64: Base 64. Additional flags:
    • padding?: <boolean> Base 64 padding.
      • false: Enforce no padding.
      • true: Enforce padding.
      • undefined: Optional padding.
  • base64URL: Base 64 URL.
  • bigInteger: Big integer number.
  • blake2b384: BLAKE 2 384.
  • blake2b512: BLAKE 2 512.
  • blake2s224: BLAKE 2 224.
  • blake2s256: BLAKE 2 256.
  • blake224: BLAKE 224.
  • blake256: BLAKE 256.
  • blake384: BLAKE 384.
  • blake512: BLAKE 512.
  • colourCMYK ♑: CMYK colour.
  • colourHex: Hex colour.
  • colourHexAlpha: Hex-alpha colour.
  • colourHSL ♑: HSL colour.
  • colourHSLA ♑: HSLA colour.
  • colourHWB ♑: HWB colour.
  • colourHWBA ♑: HWBA colour.
  • colourNCol ♑: NCol colour.
  • colourRGB ♑: RGB colour.
  • colourRGBA ♑: RGBA colour.
  • email ♑: Electronic mail address. Additional flags:
    • domain?: <string> Electronic mail address domain.
    • ipv4?: <boolean = false> Allow IPV4 as the electronic mail address domain.
    • ipv6?: <boolean = false> Allow IPV6 as the electronic mail address domain.
  • githubRepository: GitHub repository.
  • hash128: Hash 128.
  • hash160: Hash 160.
  • hash224: Hash 224.
  • hash256: Hash 256.
  • hash384: Hash 384.
  • hash512: Hash 512.
  • ip: Internet Protocol address version 4 and 6.
  • ipv4: Internet Protocol address version 4.
  • ipv6: Internet Protocol address version 6.
  • macAddress: MAC address.
  • md2: Message Digest 2.
  • md4: Message Digest 4.
  • md5: Message Digest 5.
  • md6: Message Digest 6.
  • number: Number.
  • regularExpression ♑: Regular expression.
  • semanticVersioning ♑: Semantic Versioning version 2.
  • sha1: Secure Hash Algorithm 1.
  • sha224: Secure Hash Algorithm 2 224, Secure Hash Algorithm 3 224.
  • sha256: Secure Hash Algorithm 2 256, Secure Hash Algorithm 3 256.
  • sha384: Secure Hash Algorithm 2 384, Secure Hash Algorithm 3 384.
  • sha512: Secure Hash Algorithm 2 512, Secure Hash Algorithm 3 512.
  • shebang ♑: Shebang.

    ⚠ Important: Not support flags.

  • url: Uniform Resource Locator.
  • uuid: Universally Unique Identifier.

Flag (Common)

  • boundary?: <boolean = false> Boundary; Cannot use with flag exactly.
  • caseInsensitive?: <boolean = false> Case insensitive.
  • exactly?: <boolean = false> Exact(ly); Cannot use with flag boundary.
  • global?: <boolean = false> Global.

📚 Documentation

Getting Started

Install

NodeJS (>= v14.15.0) + NPM (>= v6.14.8):

npm install @hugoalh/repattern

Use In CommonJS

const repattern = require("@hugoalh/repattern");

Use In ModuleJS

import * as repattern from "@hugoalh/repattern";

API

repattern.<patternName>(
  flag?: object = {}
): RegExp