Giter Club home page Giter Club logo

simple-regex-ts's Introduction

Hi there ๐Ÿ‘‹

simple-regex-ts's People

Contributors

dependabot[bot] avatar mashcom avatar michaeldera avatar nadchif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simple-regex-ts's Issues

[BUG] Validation of numbers with whitespace.

Describe the bug
If the number that needs to be tested contains whitespace, the regex tes will give a false result.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If possible include screenshots to help explain your problem.

Platform: Where did you see this bug (please remove those what does not apply):

  • Google Chrome
  • Safari
  • Microsoft Edge

Additional context
Please add any other context about the problem here (like the Operating System where you witnessed the bug)

Make the global flag optional

There are scenarios when the SimpleRegex tests will be run multiple times, for example, testing phone numbers during typing, after a user blurs input and just before sending an HTTP request to the server.

In these scenarios, the regex test return alternating results for the exact same phone number. After doing some digging (thanks to stack overflow), I realized that the global regex search starts from the previous match for each invocation of .test and that causes subsequent tests to have a different result even with the same input.

Example: Running SimpleRegex.MobileNumber.Econet.test(phoneNumber) twice, gives you different results

I would like to have an option to remove the global matching of the regexes.

Pattern to test MobileNumbers at once.

At the moment, testing if a value is a mobile number involves testing all three different RegExp SimpleRegex.MobileNumber.Econet.test(VALUE), SimpleRegex.MobileNumber.Netone.test(VALUE) and SimpleRegex.MobileNumber.Telecel.test(VALUE)...

A developer friendly way would be to have another single way to test all three line SimpleRegex.MobileNumber.test(VALUE), then all three can be can be tested at once.

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.