my $pattern = qr{ab[crdnfqm]def}; my $pattern = qr{ab[crdnfqm\+\s]def}; #### if $string =~ m{ ($pattern) };