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

Add all_matches function #1491

Closed
wants to merge 2 commits into from
Closed

Add all_matches function #1491

wants to merge 2 commits into from

Conversation

adambom
Copy link
Contributor

@adambom adambom commented Nov 2, 2012

This should be used in cases where you want to match multiple instances of a pattern in a string using regular expressions. This is instead of adding a g modifier, e.g. r"abc"g.

Addresses #1487

@JeffBezanson
Copy link
Sponsor Member

This is not really regex-specific, and could be done more generally with [each_match(r,s)...]. But each_match already makes it easy to iterate over the matches, so you don't usually need them in an array.

@kmsquire
Copy link
Member

kmsquire commented Nov 3, 2012

This was in response to Stephan's comment in #1487.

@JeffBezanson
Copy link
Sponsor Member

In that case I also invite @StefanKarpinski to read my comment here :)

@StefanKarpinski
Copy link
Sponsor Member

Yeah, that's pretty much why I hadn't defined this, but all_matches(r,s) is a bit easier to read than [each_match(r,s)...], so the question is whether writing that is common enough that you actually want to have all_matches. I haven't much needed it myself, so it's a bit hard to say.

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.

4 participants