Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use regex.test(str) instead of str.match(regex) #152

Merged
merged 1 commit into from Sep 18, 2018
Merged

Conversation

lencioni
Copy link
Collaborator

@lencioni lencioni commented Aug 23, 2018

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.

cc @ljharb

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.
@lencioni lencioni merged commit c7987f4 into master Sep 18, 2018
@lencioni lencioni deleted the regex-test branch September 18, 2018 20:05
@oliviertassinari
Copy link
Owner

@lencioni Well done 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants