in reply to regex for identifying encrypted text
So the problematic block of lines start with set private ", then some junk that doesn't containt quotes and then it ends with a quote, right?
You seem to be parsing this line-by-line, correct? So, modifying your code to make a very rudimentary state machine, i'd guess something like this would do:
my $isprivatekey = 0; for my $line (@diff) { if($isprivatekey) { if($line =~ /\"/) { # last line of private key $isprivatekey = 0; } next; } if($line =~ /set\ private\-key/) { # uh, get some useless stuff here $isprivatekey = 1; next; } next LINE if $line =~ /set password ENC/; [...] }
This should skip the whole private key block altogether
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex for identifying encrypted text
by hippo (Archbishop) on May 16, 2018 at 12:44 UTC | |
by QM (Parson) on Sep 03, 2019 at 11:40 UTC |