Arrow keys: ← previous · → next 36 of 37
@nodedk/regexp
0.1.0 stable isomorphic

regexp#

Shared regular expression definitions for NodeDK applications. No dependencies. Patterns are exported directly as RegExp objects.

Install#

npm i @nodedk/regexp

Usage#

var regexp = require('@nodedk/regexp')

regexp.email.test('hello@example.com') // true
regexp.slug.test('hello-world') // true

Patterns#

These patterns preserve the definitions from @nodedk/tools.

Pattern Matches
email Non-whitespace name@domain.suffix format
id At least 24 lowercase letters or digits
reg Encoded %r/pattern/flags prefix, with i and g flags
date Timestamp string format, not calendar validity
url HTTP(S) or www. address within a string
slug One or more lowercase letters, digits, hyphens, or underscores
ip IPv4 address
image GIF, JPEG, TIFF, PNG, BMP, or SVG filename extension
domain Domain format with an optional subdomain
subdomain 2–63 lowercase letters, digits, hyphens, or underscores, with alphanumeric ends

Development#

npm test

Created by Vidar Eldøy

Tools for business systems.