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";
}
}