damn-utils
Version:
Collection of some damn utilities
20 lines (11 loc) • 516 B
JavaScript
'use strict';
module.exports = {
username: /^[a-zA-Z0-9]+([._-]?[a-zA-Z0-9]+)*$/,
alphanumdash: /^[a-z0-9_-]$/,
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/,
slug: /^[a-z0-9-]+$/,
email: /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/,
url: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,
ip: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
htmltag: /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/,
};