sub match_all_letters { my( $match, $in ) = @_; my @letters = split( //, $match ); return @letters == grep { index( $in, $_ ) != -1 } @letters; } __END__ DB<2> x match_all_letters( "the" => "there" ) 0 1 DB<3> x match_all_letters( "zxd" => "there" ) 0 '' DB<4> x match_all_letters( "theq" => "there" ) 0 '' DB<5> x match_all_letters( "abcde" => "gcdabef" ) 0 1
In reply to Re: Does a regex exist for this problem?
by Fletch
in thread Regex to find intersection of two words
by 2501
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |