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

Suggestions for improvements in Regex #2460

Closed
scabug opened this issue Oct 10, 2009 · 13 comments
Closed

Suggestions for improvements in Regex #2460

scabug opened this issue Oct 10, 2009 · 13 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Oct 10, 2009

I've been using Regex in Scala 2.7 as part of a project and have a couple of suggestions to improve it.

  1. Introduce a new method, findAllMatchIn, that returns a MatchDataIterator. The other find methods of Regex generally have a findXxx and findXxxMatch variants, but in the case of findAllIn, there is only one that returns MatchIterator. To get an iterator over MatchData objects, one must call matchData on the iterator. Making this change would make the findAllIn API consistent with the other find interfaces. Deprecate the matchData method of MatchIterator.

  2. In RichString, introduce an r(groupNames: String*) method to complement the existing .r method, which does not accept group names.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 10, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2460?orig=1
Reporter: Willis Blackburn (willisblackburn)
Attachments:

  • t2460.patch (created on Jan 22, 2011 7:20:29 PM UTC, 4449 bytes)
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 17, 2009

@adriaanm said:
we'd be grateful for a patch that contributions the implementation as well as some unit tests

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 27, 2010

Lucien Pereira (lpereira) said:
An implementation can be found here : http://github.com/lpereir4/scala-starrless/compare/master...t_2460

Unit tests will come. Can someone tell me what is the rule for test file location in /test/ sub-directories, I have no idea what is the correct location.

Thanks.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 28, 2010

Lucien Pereira (lpereira) said:
You will find final proposition here : http://github.com/lpereir4/scala/compare/master...t2460

Please let me know if this is correct.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 29, 2010

Willis Blackburn (willisblackburn) said:
That looks great! Thank you for implementing this!

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 22, 2011

Lucien Pereira (lpereira) said:
Since I'm reorganizing my git repo, I join here the corresponding patch in order to keep it safe.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 29, 2011

Willis Blackburn (willisblackburn) said:
Looks like this was never incorporated.

It would be nice to at least get the group-name-aware version of "r".

Just replace

def r: Regex = new Regex(toString)

with

def r(groupNames: String*): Regex = new Regex(toString, groupNames: _*)

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 25, 2012

@dcsobral said:
I don't like the deprecation of matchData. I'm creating a pull request for this, but I'm leaving this particular bit out.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 25, 2012

@dcsobral said:
I'm also removing the arbitrary change of protected scope for MatchIterator's matcher. Such a change would require a deprecation period first, which is just not worth the trouble.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 25, 2012

@dcsobral said:
Nevermind that last comment... I've just realized why the change was made.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 25, 2012

@dcsobral said:
I created pull request 136 with the patch, minus the deprecation of matchData.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Mar 12, 2012

@dcsobral said:
Willis, to get API changes incorporated one needs to bring them up on scala-language mailing list.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Mar 26, 2012

@dcsobral said:
Closed by commit e3dec9f006ac2631281fb936c4ca206daa8fda5d.

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
2 participants
You can’t perform that action at this time.