suf-regex

raw JSON →
0.3.4 verified Sat Apr 25 auth: no javascript deprecated

A lightweight utility library providing common regex patterns and helper functions for string validation and extraction. Version 0.3.4 is the latest stable release. It offers pre-compiled regex patterns for email, URL, IP addresses, dates, and more, with a focus on simplicity and zero dependencies. Unmaintained since 2022 with no recent activity.

error Cannot find module 'suf-regex'
cause Package not installed or not ESM-compatible in a CommonJS project.
fix
Ensure package is installed: npm install suf-regex. For CommonJS, use dynamic import: const { isEmail } = await import('suf-regex').
error export 'default' (imported as 'sufRegex') was not found in 'suf-regex'
cause Attempting default import but package only has named exports.
fix
Use named imports: import { isEmail } from 'suf-regex'.
error TypeError: isEmail is not a function
cause Incorrect destructuring or using variable before assignment.
fix
Ensure correct named import: import { isEmail } from 'suf-regex'.
deprecated Package is no longer maintained as of 2022. Consider migrating to a maintained alternative like validator.js or ow.
fix Replace with validator.js: npm install validator
gotcha All functions are synchronous and perform simple regex checks; do not use for security-critical validation without additional sanitization.
fix Combine with input sanitization like DOMPurify for user-supplied content.
gotcha The package does not export a default object; you must use named imports.
fix Use `import { isEmail } from 'suf-regex'` instead of `import sufRegex from 'suf-regex'`.
npm install suf-regex
yarn add suf-regex
pnpm add suf-regex

Demonstrates importing and using email validation, URL validation, and direct regex pattern access.

import { isEmail, isURL, Patterns } from 'suf-regex';

console.log(isEmail('test@example.com')); // true
console.log(isURL('https://example.com')); // true
console.log(Patterns.email.test('invalid')); // false