in reply to Regexp match start or end
Adjust the good/bad sets as required.
use strict; use warnings; use Test::More; my @good = ( 'perfect weather', 'Nobody\'s Perfect', 'PeRfEcT!!', ); my @bad = ( 'imperfect', 'Perfecto!', 'perfection', ); my $re = qr/^perfect\b|\bperfect$/i; plan tests => @good + @bad; like $_, $re, "match for '$_'" for @good; unlike $_, $re, "no match for '$_'" for @bad;
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp match start or end
by stevieb (Canon) on Jun 04, 2024 at 08:30 UTC |