subsitution adverb :samecase

Documentation for subsitution adverb :samecase assembled from the following types:

language documentation Regexes

From Regexes

(Regexes) subsitution adverb :samecase

The :samecase or :ii substitution adverb implies the :ignorecase adverb for the regex part of the substitution, and in addition carries the case information to the replacement string:

$_ = 'The cat chases the dog';
s:global:samecase[the] = 'a';
say $_;                 # OUTPUT: «A cat chases a dog» 

Here you can see that the first replacement string a got capitalized, because the first string of the matched string was also a capital letter.