Documentation for method prematch

Documentation for method prematch, assembled from the following types:

class Match

From Match

(Match) method prematch

Defined as:

method prematch(Match:D: --> Str:D)

Returns the part of the original string leading up to the match.

'abcdefg' ~~ /cd/;
say $/.prematch;          # OUTPUT: «ab␤» 
 
# will return a list of three match objects 
"abc123def" ~~ m:g/\d/;
say $/.[1].prematch;      # OUTPUT: «abc1␤»