Re: Matching at least $x words out of @words

Rick Delaney <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
On Fri, May 06, 2005 at 02:21:17AM -0700, Yitzchak Scott-Thoennes wrote:
> On Thu, May 05, 2005 at 09:41:46PM -0400, Rick Delaney wrote:
> > 
> >       / ($alt) .* (?!\1) ($alt) /x;
> 
> Fails with words: (foo, foobar, foobaz) and string "foofoobar".

So it does.  The overlapping strings also cause problems for this
method:

    $x <= grep { $string =~ m/$_/ } @words;

If $string is "foobar" and @words is qw(foo foobar) then this
results in two words found which I don't think the OP was looking for.


-- 
Rick Delaney
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.