substitution adverb :samespace

Documentation for substitution adverb :samespace assembled from the following types:

language documentation Regexes

From Regexes

(Regexes) substitution adverb :samespace

The :samespace or :ss substitution modifier implies the :sigspace modifier for the regex, and in addition, copies the whitespace from the matched string to the replacement string:

say S:samespace/./c d/.perl given "a b";      # OUTPUT: «"c d"» 
say S:samespace/./c d/.perl given "a\tb";     # OUTPUT: «"c\td"» 
say S:samespace/./c d/.perl given "a\nb";     # OUTPUT: «"c\nd"» 

The ss/.../.../ syntactic form is a shorthand for s:samespace/.../.../.