# $format = "/[12345]/"; # I expect strings like this # $format = "/[[12345]//"; # match "[/" :-] # $format = "/aa/[[12345]//"; # match "aa/[/" my $success = 1; my $test = "x"; if ( $format =~ m!^/(.*)/$! ) { # test for "/reg.expr./" format eval { $test =~ m/$1/ }; # test of "user" reg. exp. if ( $@ ) { $success = 0; # $format is incorrect reg. expr. } }