/PAT1(?!.*PAT2)/s #### $string =~ /^ERROR(?!.*\b(?:Error processing Cancel Execution|license will expire)\b)/ms