Make the global flag optional #8
Labels
discussion
Issues under discussion
documentation
Improvements or additions to documentation
enhancement
New feature or request
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 resultsI would like to have an option to remove the global matching of the regexes.
The text was updated successfully, but these errors were encountered: