#!/usr/bin/perl use strict; use warnings; my @tests = ("\% only 1 profile is allowed\n\n", # Should fail "\n\n", # Should pass "", # Should pass ); my $regex = "(?!.*\\S)"; for (@tests) { print $_ =~ qr{$regex}ms ? "$_\n REGEX MATCHED\n" : "$_\n FAILED!\n"; }