in reply to Tri state string compare? (Solved! see update2)
Replace all "don't care characters" with . and you have a regex that does the job.
use strict; use warnings; my $abc = "AABCBAABCCCCAB"; my $ab = "AABABAABABABAB"; $abc =~ s/[^ab]/./gi; print "They match!\n" if $ab =~ /^$abc$/i;
If you want to use logical operators the following works as well
print "They match!\n" unless ($abc ^ $ab) =~ /\x{3}/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tri state string compare?
by mr_ron (Deacon) on Dec 14, 2015 at 16:09 UTC |