KP_what_I_want (space) or KP_what_I_want( or KP_what_I_want ( or KP_what_I_want + etc... #### my ($exp) = $line =~ m/ KP_ # Required (.*) # Capture Desired Output (?:\s)? # Optional - Do not capture (?:\()? # Optional - Do not capture /xi;