Course of Raku / Regexes and grammars / Regexes / Substitution and replacement / Exercises
Mask the digits
Problem
Take the string 'PIN 1234' and produce a
copy in which every digit is replaced with a
#, using the S/// operator so the original is
left unchanged. Print the masked copy, then print the original to show
it was not modified.
Example
The program prints:
PIN ####
PIN 1234Solution
Course navigation
← Solution: Lower-case letters | Solution: Mask the digits →