$criteria = "(abc|123)\$"; $teststring = "Foo walks up and says: abc"; if ( $teststring =~ /$criteria/ ) { print "Got $1\n"; } else { print "uh no, it did not\n"; } __END__ output ====== Got abc #### $criteria = qr/(abc|123)$/; ...