File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
graalpython/lib-graalpython Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ def groupdict(self, default=None):
215
215
216
216
def span (self , groupnum = 0 ):
217
217
idxarg = self .__groupidx (groupnum )
218
- return ( self .__result .getStart (idxarg ), self .__result .getEnd (idxarg ) )
218
+ return self .__result .getStart (idxarg ), self .__result .getEnd (idxarg )
219
219
220
220
def start (self , groupnum = 0 ):
221
221
idxarg = self .__groupidx (groupnum )
@@ -239,11 +239,17 @@ def endpos(self):
239
239
240
240
@property
241
241
def lastgroup (self ):
242
- return self .__compiled_regex .groupCount
242
+ lastindex = self .lastindex
243
+ if lastindex is not None :
244
+ return self .__group (lastindex )
243
245
244
246
@property
245
247
def lastindex (self ):
246
- return self .__result .getEnd (0 )
248
+ lastindex = None
249
+ for index in range (1 , self .__compiled_regex .groupCount ):
250
+ if self .__result .getStart (index ) >= 0 :
251
+ lastindex = index
252
+ return lastindex
247
253
248
254
def __repr__ (self ):
249
255
return "<re.Match object; span=%r, match=%r>" % (self .span (), self .group ())
You can’t perform that action at this time.
0 commit comments