File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -704,6 +704,8 @@ class Builder {
704704 clone . _modifiers = this . _modifiers
705705 clone . _lastMethodType = this . _lastMethodType
706706 clone . _group = this . _group
707+ clone . _captureNames = Array . from ( this . _captureNames )
708+ clone . _implodeString = this . implodeString
707709
708710 return clone
709711 }
Original file line number Diff line number Diff line change @@ -178,4 +178,18 @@ describe('Builder isMatching', () => {
178178
179179 assert . deepEqual ( regex , / (?: f o o ) / )
180180 } )
181+
182+ it ( 'Stores named captures' , ( ) => {
183+ const regex_new = new SRL ( "capture (anything once or more) as first" ) ;
184+ const testcase = 'hello world' ;
185+
186+ let matches_new = regex_new . getMatch ( testcase )
187+ assert . equal ( matches_new [ "first" ] , 'hello world' )
188+
189+ const regex_cached = new SRL ( "capture (anything once or more) as first" ) ;
190+
191+ let matches_cached = regex_cached . getMatch ( testcase )
192+ assert . equal ( matches_cached [ "first" ] , 'hello world' )
193+
194+ } )
181195} )
You can’t perform that action at this time.
0 commit comments