oro-regexp
v2.1.5
Published
REGEXP is essentially an object that holds regular expressions
Downloads
132
Readme
Oro RegExp
Overview
REGEXP
is essentially an object that holds regular expressions.
Installation
npm install oro-regexp
Example:
// js
const { REGEXP } = require( 'oro-regexp' );
// or individually
const { REGEXP_EMAIL, REGEXP_URL_YOUTUBE, ... } = require( 'oro-regexp' );
// ts
import { REGEXP } from 'oro-regexp';
// or individually
import { REGEXP_EMAIL, REGEXP_URL_YOUTUBE, ... } from 'oro-regexp';
REGEXP_EMAIL.test('info@example');
// false
REGEXP_EMAIL.test('[email protected]');
// true
Regular Expressions
Emails
REGEXP.EMAIL | REGEXP_EMAIL;
// [email protected]
// [email protected]
Urls
REGEXP.URL_YOUTUBE | REGEXP_URL_YOUTUBE;
// youtube.com/watch?v=ID
// https://youtube.com/watch?v=ID
// http://youtube.com/watch?v=ID
// www.youtube.com/watch?v=ID
// m.youtube.com/watch?v=ID
// youtu.be/ID
Dates
REGEXP.DATETIME_DEFAULT_STRICT | REGEXP_DATETIME_DEFAULT_STRICT;
// 30-12-2020 11:59[:59]
REGEXP.DATETIME_HTML_STRICT | REGEXP_DATETIME_HTML_STRICT;
// 30/12/2020 11:59[:59]
REGEXP.DATETIME_SQL_STRICT | REGEXP_DATETIME_SQL_STRICT;
// 2020-12-30 11:59[:59]
REGEXP.DATETIME_FN_STRICT('.') | REGEXP_DATETIME_FN_STRICT('.');
// 30.12.2020 11:59[:59]
REGEXP.DATETIME_DEFAULT | REGEXP_DATETIME_DEFAULT;
// 30-12-2020 [11:59[:59]]
REGEXP.DATETIME_HTML | REGEXP_DATETIME_HTML;
// 30/12/2020 [11:59[:59]]
REGEXP.DATETIME_SQL | REGEXP_DATETIME_SQL;
// 2020-12-30 [11:59[:59]]
REGEXP.DATETIME_FN('.') | REGEXP_DATETIME_FN('.');
// 30.12.2020 [11:59[:59]]
REGEXP.DATE_DEFAULT | REGEXP_DATE_DEFAULT;
// 30-12-2020
REGEXP.DATE_HTML | REGEXP_DATE_HTML;
// 30/12/2020
REGEXP.DATE_SQL | REGEXP_DATE_SQL;
// 2020-12-30
REGEXP.DATE_FN('.') | REGEXP_DATE_FN('.');
// 30.12.2020