Scenario 1 my $comment="These are the wild characters value @#$%^&*<\Comment>"; if ($comment !~ /\*[^|<|^>|^\/]*\<\/Comment\>/) { print "Passed the test as there were no > < / in the comment \n"; } Scenario 2 my $comment="These are the wild characters value @#$%^&* > < / <\Comment>"; if ($comment !~ /\*[^|<|^>|^\/]*\<\/Comment\>/) { print "Passed the test as there were no > < / in the comment \n"; } else { print "Failed the test as there were > < / characters in the comment \n"; } User will input the following as a comment. And the regular expression should negate any < > / character entered as sentence in the USERSTORY . USERSTORY<\Comment>