That's worked like a charm, You ALL are great.

Thanks everyone for help.

Sara.


----- Original Message ----- From: <[EMAIL PROTECTED]>
To: "'Sara'" <[EMAIL PROTECTED]>
Sent: Thursday, August 18, 2005 10:50 PM
Subject: RE: Regex Problem.


Hi Sara,

what is about somthing like
$string = 'blood';
for($i=0; $i<=length($string)-3;$i++) {

check(substr($string,$i,3));
}



Mit freundlichen GrĂ¼ssen
   Ihr echtwahr.Webmaster

------------------------
http://www.echtwahr.de
http://www.echtwahr.com
-----Original Message-----
From: Sara [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 18, 2005 5:48 PM
To: beginners-cgi@perl.org
Subject: Regex Problem.

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





--
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