Thanks for your respone KevinR, however $inbad3 fails (says it's good when it should be bad). Below is a better version of the program thus far so please ignore the 1st one. Set $test to any of the $in strings to see what is good or bad. What I have labeled 'stuff' and 'morestuff' can be any number of characters except [ or ] or , (comma) characters.

Also, another rule is that the $in strings cannot be modified to 'fix' the problem.

$inbad1 = "[0],[0,1],[1,0,3,5]";

$inbad2 = "[[0],[0,2]]";

$inbad3 = "[[0]stuff,morestuff[0,4]]";

$ingood1 = "[0][0,1,2][0,1]";

$ingood2 = "[0]stuff[0,1][1,0,2,5]";

$test = $inbad3;

if ($test =~ /\,/) {

# If there are , (comma) character(s) then they all must be located between a set of [ ] (bracket) characters.