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: define numbered groups in docs #3953

Closed
campoy opened this issue Aug 15, 2012 · 13 comments
Closed

regexp: define numbered groups in docs #3953

campoy opened this issue Aug 15, 2012 · 13 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@campoy
Copy link
Contributor

campoy commented Aug 15, 2012

We should include the syntax documentation in the package, and clarify the fact that
FindSubmatch returns the list of numbered groups from the regexp.
@rsc
Copy link
Contributor

rsc commented Aug 31, 2012

Comment 1:

Please note that bug summaries should have the form 'package/path: foo'.
I am not sure what you are asking for.
Quoting from the docs:
The syntax of the regular expressions accepted is the same general syntax used by Perl,
Python, and other languages. More precisely, it is the syntax accepted by RE2 and
described at http://code.google.com/p/re2/wiki/Syntax, except for \C.
...
If 'Submatch' is present, the return value is a slice identifying the successive
submatches of the expression. Submatches are matches of parenthesized subexpressions
within the regular expression, numbered from left to right in order of opening
parenthesis. Submatch 0 is the match of the entire expression, submatch 1 the match of
the first parenthesized subexpression, and so on.

@campoy
Copy link
Contributor Author

campoy commented Aug 31, 2012

Comment 2:

There's two points in this bug:
1- Move the documentation of the regexp syntax to the go.doc package so it appears in
the same page. Removing the non implemented fields, maybe?
2(and most important)- I had a hard time finding that what it's called 'numbered groups'
in one doc is referred as 'submatches' in the other. Maybe just adding 'numbered groups'
somewhere indicating that it's an equivalent term may help.
For the second point I must say that when I'm programming I tend to use the search
feature of my browser a lot ... if I don't find 'group' or 'numbered' in the spec I
assume it's not here. Is this wrong? Maybe, but I'm not the only one doing this ...

@rsc
Copy link
Contributor

rsc commented Aug 31, 2012

Comment 3:

I would be happy for you to address #2.  I am very reluctant to make a copy of #1, which
I think would overwhelm the rest of the docs.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 4:

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 5:

Labels changed: added go1.1.

@speter
Copy link

speter commented Sep 18, 2012

Comment 6:

Regarding #1 above, I agree that including the syntax in the package godoc page would
overwhelm the rest, but I think it would still be useful if the syntax was included as
part of the Go distribution. Wouldn't it be possible to include it as a separate page
and add a link to it? The distribution already includes ancillary pages for several
other packages. (See Documents / Go Articles / Packages, http://golang.org/doc/#articles
)

@minux
Copy link
Member

minux commented Sep 18, 2012

Comment 7:

I agree. I think we can add that as an article so that people
can reference even when they don't have access to re2 wiki.

@adg
Copy link
Contributor

adg commented Sep 21, 2012

Comment 8:

rsc: I understand your reluctance to do #1, but I think it's better that our docs be
self-contained. Trimming the unsupported features from the list would make it shorter,
in any case.

@adg
Copy link
Contributor

adg commented Sep 21, 2012

Comment 9:

(FWIW I've had a couple of conversations with Go programmers lately and they complained
about this.)

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 10:

'godoc regexp/syntax' shows syntax now. All that remains is #1.

Labels changed: added go1.1maybe, removed go1.1.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 11:

Labels changed: added size-s.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 12:

Labels changed: added suggested.

@robpike
Copy link
Contributor

robpike commented Mar 11, 2013

Comment 13:

This issue was closed by revision 1b3c969.

Status changed to Fixed.

@campoy campoy added fixed Suggested Issues that may be good for new contributors looking for work to do. labels Mar 11, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

7 participants