Giter Club home page Giter Club logo

hey-regex's Introduction

Overview

NPM package that uses Javascript RegEx that checks common inputs like numbers, alpha numeric, email and url.

Build Status

Installation

npm i hey-regex --save

Setup & Basic Usage

const heyRegex = require('hey-regex')
// or ES6 import
import heyRegex from 'hey-regex'

console.log(heyRegex.isWholeNumber(123)) // returns true
console.log(heyRegex.isWholeNumber(123.3)) // returns false

console.log(heyRegex.isDecimalNumber(12.3)) // returns true
console.log(heyRegex.isDecimalNumber(123.37777, "roundOff)) // returns true

console.log(heyRegex.isAlphaNumeric("testing01", "withoutSpace")) // returns true
console.log(heyRegex.isAlphaNumeric("hello world", "withSpace")) // returns true
console.log(heyRegex.isAlphaNumeric("hello world", "withoutSpace")) // returns false

console.log(heyRegex.isEmailId("[email protected]", "common")) // returns true

console.log(heyRegex.isEmailId("[email protected]", "uncommon")) // returns true

console.log(heyRegex.isUrl("https://bing.com", "withProtocol")) // returns true
console.log(heyRegex.isUrl("https://bing.com", "optionalProtocol")) // returns true
console.log(heyRegex.isUrl("bing.com", "optionalProtocol")) // returns true

Additional Info

| Functions | Options | | - | - | - | | isWholeNumber() | none | If number is whole number or not | | isDecimalNumber() | roundOff (Optional only) | | isAlphaNumeric() | withSpace & withoutSpace | | isEmailId() | common & uncommon | | isUrl() | withProtocol & optionalProtocol |

(Will add more regEx checker in the future if necessary.)

RegEx Used

Visit the regEx-utils.js file.

Contribute

Feel free to clone or fork this project: https://github.com/deanilvincent/hey-regex.git

Contributions & pull requests are welcome!

I'll be glad if you give this project a โ˜… on Github :)

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

hey-regex's People

Contributors

deanilvincent avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.