#!/usr/bin/perl -w use strict; my $string = '2B3K1/8/3N1p1p/6pk/5P1P/6P1/7r/5r2 w - -'; if($string =~ m![1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+/[1-8pPbBnNrRqQkK]+ [wb] [-KkQq] [-a-h36]+!) { print "yo"; }