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}/;
In reply to Re: Tri state string compare?
by hdb
in thread Tri state string compare? (Solved! see update2)
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |