PWC 185
PWC 185 Challenge 2 (Mask Code) Given a list of arbitrary strings consisting of alphanumeric and other characters, we are asked to run a script that replaces the first four alphanumeric characters in each string with x. Thus (from the test example), 'ab-cde-123' gets converted to 'xx-xxe-123'. This is a one-liner in Perl 5 and Raku. In Perl 5 : perl -E ' for my $test (@ARGV) {$test =~ s/[a-wyz0-9]/x/ for (1 .. 4); say $test} ' ' ab-cde-123 ' ' 123.abc.420 ' ' 3abc-0010.xy ' I loop through the strings in ARGV and for each string loop four times through a substitution regex that finds the next alphanumeric that is not x and replaces it with x. The same logic in Raku : raku -e ' @*ARGS.map({my $temp=$_; ($temp ~~ s/<[a .. w y z 0 .. 9]>/x/) for (0 .. 3); say $temp;}) ' ' ab-cde-123 ' ' 123.abc.420 ' ' 3abc-0010.xy ' In Julia I do not use a ...