Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Note that both of the elements delimited by the comma are passwords. If a password contains non alphanumeric characters it has to be in quotes.logger abcdef123,"$Ł*&GHi^
In this example I would only want to hide elements 1 & 2. The third is a username. The code I was using which worked until the passwords were changed to include non-alphanumeric characters waslogger "765)(?>jh",hhhhhh,joebloggs
A caveat is that if a password is inside quotes it may actually contain a comma as part of the password ! How do I change this to be able to handle any characters in the password ?$string =~ s/(logger\s+)(\w+)(\W+)(\w+)/$1 . ("X" x length($2) . $3 . +("X" x length($4))/e;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Match any characters
by GrandFather (Saint) on Feb 10, 2006 at 09:21 UTC | |
by Anonymous Monk on Feb 10, 2006 at 10:28 UTC | |
by GrandFather (Saint) on Feb 10, 2006 at 11:19 UTC | |
by Anonymous Monk on Feb 10, 2006 at 11:52 UTC | |
|
Re: Match any characters
by smokemachine (Hermit) on Feb 11, 2006 at 05:04 UTC |