Useful regex patterns and functions to test them.
Currently using 268
tests for 9
functions to ensure accurate results!
- CSS comments
- Email addresses
- Full numbers / Integer
- Full numbers / Integer (Negative)
- Full numbers / Integer (Positive)
- Hex color codes
- IP addresses
- Telephone numbers
npm i regex-collection
const search = require('regex-collection')
import * as search from 'regex-collection'
The syntax is the same for JavaScript and TypeScript
const text = "Hello World contact@example.com Bye World hello@world.com"
let result = search.getEmailAddress(text)
// => ["contact@example.com", "hello@world.com"]
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