On Thursday August 18 2005 11:48 am, Sara wrote:
> I am at a loss here to generate REGEX for my problem.
>
> I have an input query coming to my cgi script, containg a word (with or
> without spaces e.g. "blood" "Globin Test" etc). What I am trying to do is
> to split this word (maximum of 3 characters) and find the BEST possible
> matching words within mySQL database. For example if the word is "blood"
>
> I want to get results using regex:
>
> for "blood":     &check(blo) then &check(loo)  &check(ood)
> for "Globin Test":     &check(Glo) then &check(lob)  &check(obi)
> &check(bin) &check(Tes) &check(est)
>
> TIA.
>
> Sara.
>
> sub check {
> my $check = $dbh -> prepare("SELECT * FROM medical WHERE def LIKE
> '%$query%' "); $check->execute();
> while (my @row = $check -> fetchrow_array()) {
> print "blah blah blah\n";
> }
> }

try using RLIKE instead of LIKE 

WHERE def RLIKE '$query' 







Greg

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to