-
Notifications
You must be signed in to change notification settings - Fork 18k
index/suffixarray: FindAllIndex gives wrong results for anchored regexp #30511
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
Comments
CC @griesemer |
We should adjust FindAllIndex as necessary, but I'd like to get a definitive answer on why regexp LiteralPrefix changed over time and what its correct behavior should be. Also, given how long this has not worked as expected, this is not urgent. Waiting for resolution of #30425 . |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
Reopening this. I think the info that @griesemer was waiting for is from a Go team member who knows about LiteralPrefix changes, not from the issue creator. |
Hmph. |
@rsc for the regex question |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It does reproduce with Go versions 1.3 to 1.12 (latest at the time of writing), but it works as expected in Go version 1.2.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I called the suffixarray FindAllIndex method with a regexp anchored both to the beginning and end of text (https://play.golang.org/p/TaXeqtHt4Iq):
What did you expect to see?
I expected an empty result
[]
, the same result as for the equivalent regexp method FindAllIndex (https://play.golang.org/p/PVThOv1EE8S):What did you see instead?
suffixarray FindAllIndex returned the following index pairs in "banana" for the regexp "^a$":
The FindAllIndex documentation reads:
There are no matches for the expression "^a$" in the string "banana". Therefore the result should be empty, nil.
Go 1.2 produced the expected result. This is a regression in Go 1.3 where the behaviour of the regexp method LiteralPrefix changed. See the discussion in #30425.
The text was updated successfully, but these errors were encountered: