in reply to Matching backslash in regexp negative lookbehind
I don't understand the significance of the (?<!\\\\) assertion in the regex in the OP (copied as-is in tybalt89's reply). It suppresses elision of secret values when the single- or double-quoted key phrase is immediately preceded by a \\ double backslash but not by a single backslash. Is this intended? Output from tybalt89's working code with a few minor output formatting modifications:
c:\@Work\Perl\monks\1nickt>perl tybalt89_pm1206554_1.pl {'password' => 'secret'} -> {'password' => '***'} {"password" => "sec\"ret"} -> {"password" => "***"} {\'password' => 'secret'} -> {\'password' => '***'} {\"password" => "sec\"ret"} -> {\"password" => "***"} {\\'password' => 'secret'} -> {\\'password' => 'secret'} {\\"password" => "sec\"ret"} -> {\\"password" => "sec\"ret"}
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching backslash in regexp negative lookbehind
by 1nickt (Canon) on Jan 03, 2018 at 00:16 UTC |