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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9666?orig=1 |
@som-snytt said: |
@SethTisue said: |
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.
17 tasks
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
Since 2.12 requires 1.8, and regex.Matcher honors inline group names since 1.7, matching.Regex.Match should use the platform facility.
The text was updated successfully, but these errors were encountered: