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/syntax: \Z not documented/implemented #14793

Closed
perillo opened this issue Mar 12, 2016 · 6 comments
Closed

regexp/syntax: \Z not documented/implemented #14793

perillo opened this issue Mar 12, 2016 · 6 comments
Milestone

Comments

@perillo
Copy link
Contributor

perillo commented Mar 12, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go1.6 linux/amd

The documentation of the regexp/syntax package, in the "Empty strings" sections, says:

$              at end of text (like \z not \Z) or line (flag m=true)

However \Z is not documented, and it does not appear in the source code, except this comment in the (*Regex).Equal method:

// The parse flags remember whether this is \z or \Z.
@bradfitz bradfitz added this to the Go1.7 milestone Mar 12, 2016
@bradfitz
Copy link
Contributor

/cc @rsc for thoughts

@perillo
Copy link
Contributor Author

perillo commented Mar 12, 2016

git log -p regexp/syntax | grep -w '\\Z' reports:

   $              at end of text (like \z not \Z) or line (flag m=true)
+  $              at end of text (like \z not \Z) or line (flag m=true)
+       // The parse flags remember whether this is \z or \Z.

It seems that \Z is a typo or it was a planned feature never implemented.

@junyer
Copy link
Contributor

junyer commented Mar 14, 2016

It seems that \Z is a typo or it was a planned feature never implemented.

The WasDollar flag in RE2 – and in Go – is for distinguishing between $ and \z. As such, the comment at https://github.com/golang/go/blob/master/src/regexp/syntax/regexp.go#L71 should be corrected.

The regexp/syntax documentation does not describe \Z, so it might not be helpful to mention it when describing $. https://golang.org/s/re2syntax does describe \Z as "at end of text, or before newline at end of text (NOT SUPPORTED)".

@rsc
Copy link
Contributor

rsc commented May 18, 2016

If someone wants to change "not \Z" to "not Perl's \Z", LGTM.

@bradfitz
Copy link
Contributor

@gopherbot
Copy link

CL https://golang.org/cl/23201 mentions this issue.

@golang golang locked and limited conversation to collaborators May 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants