in reply to How regex works here?
>perl -wMstrict -le "my $line = 'B6y green $1$Byf3501d$dPtaW2vCbq63sdsw'; $line =~ s{ \s \S+ $ }{}xms; print qq{'$line'}; " 'B6y green' [download]