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

String#match vs String#scan #185

Open
AlexWayfer opened this issue Aug 20, 2020 · 3 comments
Open

String#match vs String#scan #185

AlexWayfer opened this issue Aug 20, 2020 · 3 comments

Comments

@AlexWayfer
Copy link

Hello.

These methods are pretty similar.

I've done some benchmarks and figured out that match is twice faster than scan.

I can try to make a PR, but not sure do we need for it here.

@ParadoxV5
Copy link

Friendly reminder: String#match outputs a MatchData while String#scan outputs an Array.

@AlexWayfer
Copy link
Author

Friendly reminder: String#match outputs a MatchData while String#scan outputs an Array.

Yes, but they're similar, but an outside code will be different for the same input data (String and Regexp). But the point of comparison of these approaches is they complete the similar goal.

@mateusdeap
Copy link
Member

mateusdeap commented Nov 7, 2022

@AlexWayfer If you're still interested in this, feel free to open a PR. All you need to do is follow the guidelines in the CONTRIBUTING.md.

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

No branches or pull requests

3 participants