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: Scan the input string backward for patterns ending in $ #21743

Open
sylvinus opened this issue Sep 2, 2017 · 4 comments
Open

regexp: Scan the input string backward for patterns ending in $ #21743

sylvinus opened this issue Sep 2, 2017 · 4 comments

Comments

@sylvinus
Copy link
Contributor

@sylvinus sylvinus commented Sep 2, 2017

As suggested by @rsc:

It seems clear that we should handle patterns ending in $, like \.(jpe?g|gif)$, by scanning the string backward, which cuts the processing from O(n) to O(1) for an input of size n. That's easy to add to the existing matchers and doesn't need to be limited to fixed-size patterns.

I'm working on a CL to implement it for strings and byte slices.

@odeke-em

This comment has been minimized.

Copy link
Member

@odeke-em odeke-em commented Sep 3, 2017

@sylvinus thank you for creating the issue and for working on the CL. For posterity, I kindly wanted to ask if you could quote/provide the reference e.g with a link or so. This way, everyone interested in the issue can refer back to it and have context of the discussion.

@sylvinus

This comment has been minimized.

Copy link
Contributor Author

@sylvinus sylvinus commented Sep 3, 2017

Hi @odeke-em! Not sure what you mean because I've already included a link to his comment in this issue?

@odeke-em

This comment has been minimized.

Copy link
Member

@odeke-em odeke-em commented Sep 3, 2017

Sorry about that! I didn't see #21463 (comment) as the hyperlink to suggested. Thanks for giving me a double check, I'll def go sleep, it is 5:29AM and am not clearly observing things :)

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 10, 2019

Change https://golang.org/cl/171417 mentions this issue: regexp: Scan backwards for patterns ending in $

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.