in reply to Re^2: Regex String
in thread Regex String

You're welcome! And in that case, I'd change those checks to the following:

die "Not a valid file, Check output!" if $dumpbuf =~ m/[^0-9A-F]/; #ma +tch one die "File contains only zeros, Check output!" if $dumpbuf !~ m/[1-9A-F +]/; #match two

(In particular, note that the second regex should include A-F, since otherwise some valid files will be rejected.)

Replies are listed 'Best First'.
Re^4: Regex String
by SimonPratt (Friar) on Jul 04, 2014 at 10:15 UTC

    You could also try the following, as an alternative solution:

    die "Invalid file, check output!" unless $dumpbuf =~ /^(?!0*$)[0-9A-F]+$/; # Ensure file contains a hex string other than all 0