fast-regex
v1.1.1
Published
Premade regex templates
Downloads
3
Maintainers
Readme
🔮 JavaScript Support
| Type | Support | | -------- | ------- | | commonjs | ✅ | | ES6 | ✅ | | Browser | ✅ |
⚙️ Installation
npm i fast-regex
CDN Links:
https://www.unpkg.com/[email protected]/fastRegex.js
https://cdn.jsdelivr.net/npm/[email protected]/fastRegex.js
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')