regular-expression-utility
v2.0.0
Published
I help you to use regular expressions already defined.!
Downloads
41
Maintainers
Readme
regular-expression-utility
I help you to use regular expressions already defined.
Install
npm install --save regular-expression-utility
Usage
import React from "react";
import Utility, { Expression } from "regular-expression-utility";
const Home = () => {
return <>{Utility.test(Expression.PASSWORD, "wMH432595@") ? "Yes" : "NO"}</>;
};
or
import React from "react";
import Utility from "regular-expression-utility";
const Home = () => {
return (
<>{Utility.test(new RegExp("^[0-9]+$"), "a8888") ? "Yes" : "NO"}</>
);
};
Expression
PASSWORD: "This regular expression validates a strong password that must have a lowercase letter, an uppercase letter, a number, a special character and a minimum of 8 digits"
HEX_COLOR: "This regular expression validates a hexadecimal color."
RGB_COLOR: "This regular expression validates a rgb color."
EMAIL: "This regular expression validates an email."
IPV4: "This regular expression validates an IP 4."
IPV6: "This regular expression validates an IP 6."
TELEPHONE_NUMBER: "This regular expression validates a valid phone number."
TELEPHONE_EXTENSION_NUMBER: "This regular expression validates a valid phone with its extension."
MM_DD_YYYY: "This regular expression validates a valid date in the format: MM-DD-YYYY"
DD_MM_YYY: "This regular expression validates a valid date in the format: DD-MM-YYY"
YYYY_MM_DD: "This regular expression validates a valid date in the format: YYYY-MM-DD"
POSTAL_CODE: "This regular expression validates a valid postal code."
TWITTER_USERNAME: "This regular expression validates a valid twitter username."
CREDIT_CARD: "This regular expression validates a valid credit card."
WHITE_SPACE : "This regular expression checks if a text string contains whitespace."
ONLY_NUMBERS: "This regular expression checks if a text string contains only numbers."
ONLY_LETTERS: "This regular expression checks if a text string contains only letters."
NUMBERS_BETWEEN_1_100: "This regular expression checks if a text string is a number from 1 to 100."
LETTERS_WITH_SPACES: "This regular expression checks if a text string contains only letters and whitespace."
LETTERS_AND_NUMBERS: "This regular expression checks if a text string contains only letters and numbers."
INTEGERS_AND_DECIMALS_NUMBERS: "This regular expression checks if a text string is an integer or a decimal."
POSITIVE_AND_NEGATIVE_INTEGER_NUMBERS: "This regular expression tests whether a text string is a positive or negative integer."
HOUR_FORMAT_12: "This regular expression checks if a text string is a valid time in 12-hour format."
HOUR_FORMAT_24: "This regular expression checks if a text string is a valid time in 24-hour format."
USERNAME: "This regular expression validates usernames with lowercase letters, numbers, underscores, and underscores. Usernames must be between 3 and 16 characters."
URL: "This regular expression validates a URL."
SQL: "This regular expression validates a SQL."
HTML_TAG: "This regular expression checks if an html tag is valid."
SLUG: "This regular expression checks if a text string contains letters, numbers and the special character -."
ISBN: "This regular expression validates a International Standard Book Number (ISBN)."
License
MIT © [Rafael Mayor Alberto].