diff --git a/spec.html b/spec.html
index bdb8fff956..fbaf0712cc 100644
--- a/spec.html
+++ b/spec.html
@@ -36265,6 +36265,7 @@
1. Let _groups_ be *undefined*.
1. Let _hasGroups_ be *false*.
1. Perform ! CreateDataPropertyOrThrow(_A_, *"groups"*, _groups_).
+ 1. Let _matchedGroupNames_ be a new empty List.
1. For each integer _i_ such that _i_ ≥ 1 and _i_ ≤ _n_, in ascending order, do
1. Let _captureI_ be _i_th element of _r_'s _captures_ List.
1. If _captureI_ is *undefined*, then
@@ -36282,17 +36283,14 @@
1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_i_)), _capturedValue_).
1. If the _i_th capture of _R_ was defined with a |GroupName|, then
1. Let _s_ be the CapturingGroupName of that |GroupName|.
- 1. Let _isMatchedEarlier_ be *false*.
- 1. For each integer _j_ such that _j_ ≥ 1 and _j_ < _i_, do
- 1. If the _j_th capture of _R_ was defined with a |GroupName|, then
- 1. Let _sj_ be the CapturingGroupName of that |GroupName|.
- 1. If SameValue(_sj_, _s_) is *true* and the _j_th element of _r_'s _captures_ List is not *undefined*, set _isMatchedEarlier_ to *true*.
- 1. If _isMatchedEarlier_ is *false*, then
+ 1. If _matchedGroupNames_ contains _s_, then
+ 1. Assert: _capturedValue_ is *undefined*.
+ 1. Append *undefined* to _groupNames_.
+ 1. Else,
+ 1. If _capturedValue_ is not *undefined*, append _s_ to _matchedGroupNames_.
1. NOTE: If there are multiple groups named _s_, _groups_ may already have an _s_ property at this point. However, because _groups_ is an ordinary object whose properties are all writable data properties, the call to CreateDataPropertyOrThrow is nevertheless guaranteed to succeed.
1. Perform ! CreateDataPropertyOrThrow(_groups_, _s_, _capturedValue_).
1. Append _s_ to _groupNames_.
- 1. Else,
- 1. Append *undefined* to _groupNames_.
1. Else,
1. Append *undefined* to _groupNames_.
1. If _hasIndices_ is *true*, then