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 [email protected] Bye World [email protected]"
let result = search.getEmailAddress(text)
// => ["[email protected]", "[email protected]"]
const text = "Hello World [email protected] Bye World [email protected]"
let result = search.isEmailAddress(text)
// => false
const text = "[email protected]"
let result = search.isEmailAddress(text)
// => true