regex-collection
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

REGEX-COLLECTION

NPM CodeFactor Grade Travis (.org) GitHub package.json version npm npm bundle size

Useful regex patterns and functions to test them.

Currently using 268 tests for 9 functions to ensure accurate results!

✅ Supported patterns for:

  • CSS comments
  • Email addresses
  • Full numbers / Integer
  • Full numbers / Integer (Negative)
  • Full numbers / Integer (Positive)
  • Hex color codes
  • IP addresses
  • Telephone numbers

Documentation 📋


📦 Install

npm i regex-collection

📋 Usage

Importing

JavaScript

const search = require('regex-collection')

TypeScript

import * as search from 'regex-collection'

Syntax

The syntax is the same for JavaScript and TypeScript

get Get all occurrences of regex

const text = "Hello World contact@example.com Bye World hello@world.com"
 
let result = search.getEmailAddress(text)
// => ["contact@example.com", "hello@world.com"]

is Check if a string matches to a regex

const text = "Hello World contact@example.com Bye World hello@world.com"
 
let result = search.isEmailAddress(text)
// => false
const text = "contact@example.com"
 
let result = search.isEmailAddress(text)
// => true

Package Sidebar

Install

npm i regex-collection

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

27.3 kB

Total Files

21

Last publish

Collaborators

  • marvinjwendt