Regexits- Common regex at your fingertips

James Perkins - Feb 23 '19 - - Dev Community

What is Regexits?

Regexits is a lightweight npm package that handles a collection of commonly used regex patterns.

Why would you need it?

I suppose the answer is, you hate googling regex when you need to verify a SSN, PhoneNumber, or even URLSlug.

How to use it

Well the good news is, that part is simple.

npm i regexits

Then in your code

const regexits= require('regexits')

regexits(string, pattern)

What options do you currently have?

  • Date With Slashes
  • Time in 24hr
  • ISO8601 Date and time
  • HTML tag
  • HEX Color
  • URLSlug
  • Src Img Tag
  • URL
  • Positive Int
  • Negative Int
  • Integer
  • Positive Num
  • Negitive Num
  • Number
  • Phone Number
  • New Line
  • CSS Comment
  • USA & Canada Zip
  • SSN

A Quick example

const regexits = require('regexits')

let isSSN = regexits('012-34-5678', 'SSN')

return isSSN;

#This Returns true

So overall its a pretty flexible tool that covers a collection of Regex that is commonly used over and over again. I will continuously updating the npm package along with my other open source tools.

Want a new pattern added just go ahead and add an issue via github and I will add it and republish the npm package.

Want to keep up to date with the npm package? check it out over at npm

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player