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

Regex should use inline group name #9666

Closed
scabug opened this issue Feb 22, 2016 · 3 comments
Closed

Regex should use inline group name #9666

scabug opened this issue Feb 22, 2016 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 22, 2016

Since 2.12 requires 1.8, and regex.Matcher honors inline group names since 1.7, matching.Regex.Match should use the platform facility.

@scabug
Copy link
Author

scabug commented Feb 22, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9666?orig=1
Reporter: @som-snytt
Affected Versions: 2.12.0-M3

@scabug
Copy link
Author

scabug commented Feb 22, 2016

@som-snytt said:
scala/scala#4990

@scabug scabug closed this as completed May 11, 2016
@scabug
Copy link
Author

scabug commented Aug 3, 2016

@SethTisue said:
thanks, Som, for noticing & fixing

@scabug scabug added this to the 2.12.0-M5 milestone Apr 7, 2017
rtyley added a commit to guardian/frontend that referenced this issue Jul 28, 2022
The existing code was using the `r(groupNames: String*)` extension
method on `String` to create a regex with named capturing groups, but
that Scala method was deprecated with Scala 2.13.7:

https://www.scala-lang.org/api/2.13.8/scala/collection/StringOps.html#r(groupNames:String*):scala.util.matching.Regex

The `r(groupNames: String*)` method became unnecessary as Scala adopted
Java 8 with Scala 2.12, since Java 7 introduced support for
'Named Capturing Groups' (also called 'inline group names' in related
Scala PRs):

> A capturing group can also be assigned a "name", a named-capturing
> group, and then be back-referenced later by the "name".

* https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#groupname
* https://blog.mrhaki.com/2020/04/java-joy-using-named-capturing-groups.html

The PR that deprecated the `r(groupNames: String*)` method in the
Scala standard library: scala/scala#9718 -
following on from scala/scala#4990 and
scala/bug#9666.
ioannakok pushed a commit to guardian/frontend that referenced this issue Jul 29, 2022
The existing code was using the `r(groupNames: String*)` extension
method on `String` to create a regex with named capturing groups, but
that Scala method was deprecated with Scala 2.13.7:

https://www.scala-lang.org/api/2.13.8/scala/collection/StringOps.html#r(groupNames:String*):scala.util.matching.Regex

The `r(groupNames: String*)` method became unnecessary as Scala adopted
Java 8 with Scala 2.12, since Java 7 introduced support for
'Named Capturing Groups' (also called 'inline group names' in related
Scala PRs):

> A capturing group can also be assigned a "name", a named-capturing
> group, and then be back-referenced later by the "name".

* https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#groupname
* https://blog.mrhaki.com/2020/04/java-joy-using-named-capturing-groups.html

The PR that deprecated the `r(groupNames: String*)` method in the
Scala standard library: scala/scala#9718 -
following on from scala/scala#4990 and
scala/bug#9666.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants