in reply to Re^2: match exclude
in thread match exclude
Yes, that was the missing data - thank you. I still don't see the need for smartmatch. Instead, here is an SSCCE using a standard m match with a negative look-ahead:
use strict; use warnings; use Test::More; my @good = ( 'redhat-release', 'redhat-release-server' ); my @bad = ( 'redhat-release-notes', 'any-old-nonsense' ); my $re = qr/^redhat-release(?!-notes)/; plan tests => @good + @bad; for my $str (@good) { like ($str, $re, "$str matched"); } for my $str (@bad) { unlike ($str, $re, "$str not matched"); }
See How to ask better questions using Test::More and sample data for thoughts about presenting questions in this form.
|
|---|