substitution adverb :samecase
Documentation for substitution adverb
:samecase assembled from the following types:
: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.