in reply to Regular Expression Help
Hope that's the kind of thing you wanted.my $file = "xxxxxxxxx Joe xxxxxxx Fred xxxxxxxx Joe Fred Software xxxx +xxx Inc Software Fred Joe"; my $string = "Joe Fred Software Inc"; my @n = split / /, $string; my $max = 2**@n; for (my $i = 0; $i < $max; ++$i) { my ($bits, @used) = $i; while ($bits) { my $high_bit = int(log($bits)/log(2)); push @used, $n[$high_bit]; $bits &= ~(2**$high_bit); } my $match = join " ", @used; print "$match\n" if $file =~ m/$match/; }
|
|---|