michaeldera / simple-regex-ts Goto Github PK
View Code? Open in Web Editor NEWA simple package with common regex patterns for Zimbabwe
Home Page: https://www.npmjs.com/package/simple-regex
License: MIT License
A simple package with common regex patterns for Zimbabwe
Home Page: https://www.npmjs.com/package/simple-regex
License: MIT License
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:
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):
Additional context
Please add any other context about the problem here (like the Operating System where you witnessed the bug)
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.