In Regexes§
See primary documentation in context for 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/a ./c d/.raku given "a b"; # OUTPUT: «"c d"»say S:samespace/a ./c d/.raku given "a\tb"; # OUTPUT: «"c\td"»say S:samespace/a ./c d/.raku given "a\nb"; # OUTPUT: «"c\nd"»
The ss/.../.../
syntactic form is a shorthand for s:samespace/.../.../
.