in reply to Searching for Base64
I think an example of the text you are trying to parse would be useful. But for something as simple as a CSV file split() usually does the trick. Then compare each field against the character class for Base64 encoded characters. When a mach is found convert it. Store everything up in a new array and print that out when you are done
# $string should contain the 'slurped' file my @newfields; foreach(split(/\s*,\s*/,$string)){ s/^([A-Za-z0-9+\/]*)$/decode_base64($1)/e; push(@newfields,$_); } my $newfile = join(',',@newfields);
The problem you are probably going have is that Base64 text looks a lot like normal text (thats kinda the point of it). You need something identify it as base64 text or a sentence or any word will also look like base 64 text.
|
|---|