Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use regex.test(str) instead of str.match(regex) (#152)
This method returns a boolean so it should be faster and more memory efficient. In order to make this work, I needed to remove the global flag from the regexes, because that makes the regexes mutable when run multiple times. Since these are only used to test for any match, and not for any matching groups or in any other way, we don't need this flag.
- Loading branch information
Showing
2 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters