Skip to content
regexits is a lightweight javascript Regex solution
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
helper
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
LICENSE
README.md
index.js
package-lock.json
package.json
test.js

README.md

Build Status tippin.me Donate.Paypal Donate.Coffee Donate.Patreon

Regexits a light weight regex npm package for common used regex match, string manipulation.


To install

npm install regexits

To Use

const regexits = require('regexits')

// To find if a string matches a pattern.
regexits.match(string, pattern);

// To remove a certain type from a string.
regexits.removeFromString(string, pattern);

// To get parameters from url.
regexits.getURLParameters(url);

Quick Example

const regexits = require('regexits')

regexit.match('012-34-5678', 'SSN')

returns true

const strippedString = regexits.removeFromString('REGE5634324XITS IS52353 GREA55454T' , 'REMOVENUMBERS');

returns 'REGEXITS IS GREAT'

const parameter = regexits.getURLParameters('http://url.com/page?name=Adam&surname=Smith');

returns {name: 'Adam',surname: 'Smith',}

Patterns for matching that are current available

  • DateSlashes , Time24hr , Date
  • ISO8601DT , HTMLtag , HEXColor
  • URLSlug , SrcImgTag , URL
  • Email, Password , PosInt
  • NegInt, Integer , PosNum
  • NegNum, Num ,PhoneNum
  • NewLine , CSSComment , USCAZip
  • SSN , EMAIL, IPV4
  • IPV6 , IPV4ORV6 , VISA
  • MASTERCARD , AMEX ,DINERS
  • DISCOVER, JCB , POBOX
  • SHA256 , MD5 , MAINNET
  • TESTNET , GITHUB

To remove from string

  • SPECIALCHARS
  • ALLWHITESPACE
  • TRIMEND
  • TRIMBEGIN
  • REMOVENUMBERS
  • LEAVENUMBERS

Reporting issue / Feature (new pattern)

To report issue please use the issue template in the repo to follow.

To Contribute

To contribute please create a pull request

You can’t perform that action at this time.