use Test::Simple tests => 14; use strict; # # PUT THE REGEXP TO TEST HERE # my $testregexp = qr/\x26\x67(?!.{0,6}\x26\x67).{8}/s; sub mytest( $ ) { return( ( $_[0] =~ m/$testregexp/ ) ? 1 : 0 ); } # tests ok( mytest( "\x26\x67________" ), "lead bytes followed by 8 clear bytes" ); ok( !mytest( "\x26\x67_______" ), "lead bytes followed by only 7 clear bytes" ); ok( mytest( "\x26\x67_________" ), "lead bytes followed by 9 clear bytes" ); ok( !mytest( "\x26\x67\x26\x67______" ), "lead bytes with 2 bad bytes" ); ok( !mytest( "\x26\x67_\x26\x67_____" ), "lead bytes with 2 bad bytes" ); ok( !mytest( "\x26\x67_____\x26\x67_" ), "lead bytes with 2 bad bytes" ); ok( !mytest( "\x26\x67______\x26\x67" ), "lead bytes with 2 bad bytes" ); ok( mytest( "\x26\x67________\x26\x67" ), "lead bytes with 1 bad byte inside the eight byte limit" ); ok( mytest( "\x26\x67_______\x26\x67" ), "lead bytes with 1 bad bytes" ); ok( !mytest( "\x26\x67\x26\x67\x26\x67____" ), "lead bytes with 2 sets of bad bytes" ); ok( !mytest( "\x26\x67\x26\x67_\x26\x67___" ), "lead bytes with 2 sets of bad bytes" ); ok( !mytest( "\x26\x67_\x26\x67\x26\x67___" ), "lead bytes with 2 sets of bad bytes" ); ok( !mytest( "\x26\x67_\x26\x67___\x26\x67" ), "lead bytes with 2 sets of bad bytes" ); ok( !mytest( "\x26\x67\x26\x67____\x26\x67" ), "lead bytes with 2 sets of bad bytes" );