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

regexp: document that in *All if n < 0 means return all matches #24526

Closed
odeke-em opened this issue Mar 25, 2018 · 3 comments
Closed

regexp: document that in *All if n < 0 means return all matches #24526

odeke-em opened this issue Mar 25, 2018 · 3 comments

Comments

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Mar 25, 2018

I was just working on a simple login router and while examining regexp.FindAllString, I had to use the common knowledge that usually when you ask for n<0, that means return all the matches. However, this isn't intuitive to everyone. Perhaps let's document it.

screen shot 2018-03-25 at 2 45 03 pm

Sharing this with my other team members who might not be experienced would definitely lead to confusion as in https://play.golang.org/p/5J4Me7dgNML

@odeke-em
Copy link
Member Author

@odeke-em odeke-em commented Mar 25, 2018

The package doc for All as recommended in the comments says that if n >=0 it returns at most n matches, but doesn't say anything for if n<0
screen shot 2018-03-25 at 2 47 44 pm

@odeke-em odeke-em changed the title regexp: document that n in FindAllString if negative means return all matches regexp: document that in *All if n < 0 means return all matches Mar 25, 2018
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 25, 2018

Change https://golang.org/cl/102423 mentions this issue: regexp: document behavior of FindAll* functions when n < 0

@jimmyfrasche
Copy link
Member

@jimmyfrasche jimmyfrasche commented Mar 25, 2018

cc @rsc and @matloob by golang.org/s/owners

@andybons andybons added this to the Unplanned milestone Mar 26, 2018
@gopherbot gopherbot closed this in 9d84e0e Mar 28, 2018
@golang golang locked and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.