A library for validate a string using regular expressions.

Overview

Fogex

Form Regex

Quickly and easily check if the content is valid.

Installation

npm install fogex

or

yarn add fogex

Usage

import fogex from 'fogex';
fogex.isEmail('[email protected]'); // true
fogex.isEmail('test@test'); // false

Use with parameters

isPhoneNumber

fogex.isPhoneNumber('+1 123 4567890', 'US'); // true

isPin

fogex.isPin('1234', '4'); // true
fogex.isPin('123456', '6'); // true

isCreditCard

Default

// Accepts all card types
fogex.isCreditCard('XXXX XXXX XXXX XXXX'); // true

Use with parameters

fogex.isCreditCard('XXXX XXXX XXXX XXXX', 'VISA'); // true

Regex Patterns

Tables Description Parameter
isAscii Check if the string contains ASCII chars only.
isBoolean Check if a string is a boolean.
isCase(val, case) Check if the string is a cases. lower, upper, camel, pascal
isColorCode(val, colorCode) Check if the string is a color code. rgb, hex, hsl
isCreditCard(val, cardType) Check if the string is a credit card number. The default value accepts all card types VISA or MASTER
isEmail Check if the string is an email.
isFloat Check if the string is a float.
isHash Check if the string is a hash of type
isHour(val, hourFormat) Check if the hour format is an correct. 12 or 24
isIdentityNumber(val, locale) Check if the string is a identity number. US or TR
isImageUrl(val, extension) Check if the string is a image url. The default value accepts all image extension png, jpg, jpeg, gif
isImei Check if check if the string is a valid IMEI number.
isInteger Check if the string is an integer.
isIp Check if the string is an IP
isISBN Check if the string is an ISBN.
isMac Check if the string is a MAC address.
isMd5 Check if the string is a MD5 hash.
isMongoId Check if the string is a valid a MongoDB ObjectId.
isMonth Check if the string is a month.
isPassword Check if a password is strong or not.
isPhoneNumber(val, locale) Check if the string is a mobile phone number. US or TR
isPin(val, length) Check if the string is a pin. 4 or 6
isPlate(val, locale) Check if string the format of a plate format. US or TR
isPort Check if the string is a valid port number.
isPostalCode(val, locale) Check if the string is a postal code number. US or TR
isString Check if string of a letter
isWhiteSpace Check if the string contains white space.

Contribution

Fogex is under development, and is open to suggestions and contributions.

It is publicly open for any contribution. Bug fixes, new features and extra modules are welcome.

To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.

To report a bug: Please report it using GitHub Issues.

MIT License

Copyright (c) 2022 Emre Yilmaz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...

String validation

validator.js A library of string validators and sanitizers. Strings only This library validates and sanitizes strings only. If you're not sure if your

Jan 5, 2023

πŸŽ‰πŸŽ‰πŸŽ‰like vcsode, string/texts can be replaced in file(s).

tiny-replace-files Like vscode, simple utility to quickly replace text in one or more files. πŸ“¦ Getting Started install # npm npm install --save tiny

Nov 22, 2022

jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

Jan 3, 2023

Lightweight JavaScript form validation library inspired by CodeIgniter.

validate.js validate.js is a lightweight JavaScript form validation library inspired by CodeIgniter. Features Validate form fields from over a dozen r

Dec 15, 2022

Micro check library

is.js This is a general-purpose check library. No dependencies AMD, Node & browser ready Usage: Node.js: npm install is_js Bower: bower install is_js

Dec 27, 2022

FieldVal - multipurpose validation library. Supports both sync and async validation.

FieldVal-JS The FieldVal-JS library allows you to easily validate data and provide readable and structured error reports. Documentation and Examples D

Sep 24, 2022

jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

Jan 3, 2023

The most powerful data validation library for JS

joi The most powerful schema description language and data validator for JavaScript. Installation npm install joi Visit the joi.dev Developer Portal f

Jan 4, 2023

Lightweight and powerfull library for declarative form validation

Formurai is a lightweight and powerfull library for declarative form validation Features Setup Usage Options Methods Rules Examples Roadmap Features ?

May 13, 2022
Owner
null
jQuery library to validate html forms. compatible with bootstrap v4 and bootstrap v3

jQuery form validation jQuery form validation is a library that helps you to validate your HTML form, it's completable with both Bootstrap 3 and Boots

Bassam Nabriss 33 Jun 10, 2021
A simple library to validate Mexican CURPs (Personal ID)

Validate CURP A simple and lightweight library to validate Mexican CURPs (Personal ID). Install NodeJS Use NPM: $ npm install --save validate-curp Or

Manuel de la Torre 15 Nov 24, 2022
This Login Form made using React hooks , React Js , Css, Json. This form have 3 inputs, it also validate those inputs & it also having length limitations.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Yogesh Sharma 0 Jan 3, 2022
Validate your forms, frontend, without writing a single line of javascript

Parsley JavaScript form validation, without actually writing a single line of JavaScript! Version 2.9.2 Doc See index.html and doc/ Requirements jQuer

Guillaume Potier 9k Dec 27, 2022
The best @jquery plugin to validate form fields. Designed to use with Bootstrap + Zurb Foundation + Pure + SemanticUI + UIKit + Your own frameworks.

FormValidation - Download http://formvalidation.io - The best jQuery plugin to validate form fields, designed to use with: Bootstrap Foundation Pure S

FormValidation 2.8k Mar 29, 2021
[DISCONTINUED] jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code.

jQuery Form Validator [DISCONTINUED] Validation framework that let's you configure, rather than code, your validation logic. I started writing this pl

Victor Jonsson 976 Dec 30, 2022
A simple and composable way to validate data in JavaScript (and TypeScript).

A simple and composable way to validate data in JavaScript (and TypeScript). Usage β€’ Why? β€’ Principles β€’ Demo β€’ Examples β€’ Documentation Superstruct m

Ian Storm Taylor 6.3k Jan 9, 2023
Validate properties and well known annotations in your Backstage catalog-info.yaml files.

Backstage entity validator This package can be used as a GitHub action or a standalone node.js module GitHub action Inputs path Optional Path to the c

Roadie 39 Dec 26, 2022
Validate for XML schema and returns all the possible failures

detailed-xml-validator Validate for XML schema and returns all the possible failures Sample Rules file <?xml version = "1.0"?> <students nillable="fa

Natural Intelligence 11 Dec 20, 2022
Validate graphql operations against a schema

@graphql-validate With the power of GraphQL-Tools and GraphQL-JS, we are able to provide a smooth experience for validation your GraphQL operations du

Saihajpreet Singh 13 Dec 23, 2022