http://qs321.pair.com?node_id=502542

No-Lifer has asked for the wisdom of the Perl Monks concerning the following question:

Dear all,

Yes, my search script is giving my gyp again - It's actually because I don't know enough of what can and can't be done. I'm usually ok, given a bit of a help to get started - I think a push in the right direction is required!

My search script is a little too "rigid". If I search for "regular expression", it searches the documents on my site for the EXACT string, "regular expression" (both the words appearing on the page next to each other).

I wish to make it more flexible - allowing it to find, say, instances of "regular" AND "expression", not necessarily beside each other on the page.

My form code is pretty much standard -

if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/["]//gi; $value =~ s/[+]/ /gi; $FORM{$name} = $value; } } $keyword=$FORM{keyword};

How would I go about creating an "AND" sort of search? I'm assuming it's something to do with what I've got above.

Many thanks (again)!