This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 549782c  pending GROOVY-11701
549782c is described below

commit 549782cbf5865fd2f92b635efe4b1c302d922320
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Jun 17 12:51:46 2025 +1000

    pending GROOVY-11701
---
 site/src/site/releasenotes/groovy-5.0.adoc | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/site/src/site/releasenotes/groovy-5.0.adoc 
b/site/src/site/releasenotes/groovy-5.0.adoc
index e72f552..9dacc6b 100644
--- a/site/src/site/releasenotes/groovy-5.0.adoc
+++ b/site/src/site/releasenotes/groovy-5.0.adoc
@@ -980,7 +980,31 @@ for (int idx, var heart in hearts) {
 assert list.join() == '💚💛💛💜💜💜'
 ----
 
-=== String utility method
+=== Match operator support for named-capturing groups
+
+Groovy's match operator, `=~`, already provides a convenient notation for 
accessing regex capturing groups by index:
+
+[source,groovy]
+----
+def issueRegex = /(\w+)-(\d+)/
+def m = 'GROOVY-11701' =~ issueRegex
+assert m[0][1] == 'GROOVY'
+assert m[0][2] == '11701'
+----
+
+Groovy 5 also supports accessing groups by name using the JDKs regex support 
for _named-capturing groups_,
+with index access still available:
+
+[source,groovy]
+----
+def issueRegex = /(?<project>\w+)-(?<number>\d+)/
+def m = 'GROOVY-11701' =~ issueRegex
+assert m[0][1] == 'GROOVY'
+assert m[0]['project'] == 'GROOVY'
+assert m[0].number == '11701'
+----
+
+=== Ascii barchart utility method
 
 There is now a utility method to produce simple ascii-art barcharts. The 
following code:
 

Reply via email to