1.1.1 • Published 3 years ago
fast-regex v1.1.1
🔮 JavaScript Support
| Type | Support | 
|---|---|
| commonjs | ✅ | 
| ES6 | ✅ | 
| Browser | ✅ | 
⚙️ Installation
npm i fast-regexCDN Links:
If you are using npm to install it and then running it on the browser then use:
import fastRegex from './node_modules/fast-regex/fastRegex.js';📖 Documentation
▸ Example code:
import { fastRegex } from 'fast-regex';
console.log(fastRegex('hasAlphanumeric').test('Hello world!'));
console.log(fastRegex('imgSrc').exec('<img src="hello-world.png">'));▸ Add your own regex:
fastRegex({
    name: 'myCoolRegex',
    regex: '[0-2]'
});
console.log(fastRegex('myCoolRegex').test('69'));▸ Add your own regex with flags:
fastRegex({
    name: 'myCoolRegexWithFlags',
    regex: '[a-z]',
    flags: 'g'
});▸ All regex codes:
fastRegex('validEmail')
fastRegex('ipv4')
fastRegex('ipv6')
fastRegex('hasInteger')
fastRegex('hasAlphanumeric')
fastRegex('validPhone')
fastRegex('imgSrc')
fastRegex('validZipCode')
fastRegex('validTwitterUsername')
fastRegex('domain')
fastRegex('removeHtmlComments')
fastRegex('isPositiveInteger')
fastRegex('isNegativeInteger')
fastRegex('validCreditCard')