diff --git a/src/core.c/Match.pm6 b/src/core.c/Match.pm6 index ebe6494888f..957bbb77ea3 100644 --- a/src/core.c/Match.pm6 +++ b/src/core.c/Match.pm6 @@ -12,14 +12,11 @@ my class Match is Capture is Cool does NQPMatchRole { method Int(--> Int:D) { self.Str.Int } method STR() { - nqp::getattr(self,Match,'$!regexsub').CAPS.has-captures - ?? self!MATCH.Str - !! nqp::substr( - self.orig, - nqp::getattr_i(self,Match,'$!from'), - nqp::getattr_i(self,Match,'$!pos') - - nqp::getattr_i(self,Match,'$!from') - ) + nqp::if( + nqp::istype(nqp::getattr(self,Match,'$!match'), NQPdidMATCH), + self.Str, + self!MATCH.Str + ) } method MATCH() {