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: add LeftmostLongest() method #3696

Closed
rsc opened this issue Jun 3, 2012 · 10 comments
Closed

regexp: add LeftmostLongest() method #3696

rsc opened this issue Jun 3, 2012 · 10 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jun 3, 2012

In regexp, cannot use Perl syntax + leftmost-longest matching. Add 

func (re *Regexp) LeftmostLongest() 

method to cause regexp to search for leftmost-longest instead of leftmost-first.
@rsc
Copy link
Contributor Author

rsc commented Jun 3, 2012

Comment 1:

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

@rsc
Copy link
Contributor Author

rsc commented Dec 10, 2012

Comment 2:

Labels changed: added size-m.

@adg
Copy link
Contributor

adg commented Jan 17, 2013

Comment 3:

https://golang.org/cl/7133051

Owner changed to @adg.

Status changed to Started.

@rsc
Copy link
Contributor Author

rsc commented Jan 18, 2013

Comment 4:

I just noticed that we already have CompilePOSIX. We might as well
have CompileLongest.
But again we need to fix the ab? problem too.

@adg
Copy link
Contributor

adg commented Jan 18, 2013

Comment 5:

I'm out of my depth as far as fixing the regexp engine.
Does this look correct to you?
  http://play.golang.org/p/rYOj6jVlbi

@gopherbot
Copy link

Comment 6 by Zarevucky.Jiri:

They are not equivalent. See http://code.google.com/p/re2/wiki/Syntax.
Alternative prefers shorter, ? always prefers longer variant.

@gopherbot
Copy link

Comment 7 by Zarevucky.Jiri:

According to http://code.google.com/p/re2/wiki/Syntax, they are not equivalent.
a? always prefers a to be present, but | prefers the first variant. So the equivalent
expression to ab? would be a(b|), and not a(|b).

@rsc
Copy link
Contributor Author

rsc commented Jan 22, 2013

Comment 8:

http://play.golang.org/p/rYOj6jVlbi is correct (ab ab ab a).
It's fine to just leave this open. I'll fix the regexp match (if there is a
bug, but it sure sounded like it on the review) once bigger stuff is done.
It will be easy.
Russ

@rsc
Copy link
Contributor Author

rsc commented Jan 31, 2013

Comment 9:

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

@adg
Copy link
Contributor

adg commented Feb 4, 2013

Comment 10:

This issue was closed by revision f41ffc2.

Status changed to Fixed.

@rsc rsc added fixed labels Feb 4, 2013
@rsc rsc assigned adg Feb 4, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned adg Jun 22, 2022
This issue was closed.
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

3 participants