Hi there. If you can help you are a star.
I want user to:
Enter text into box A
Enter a pattern into box B
Box B is matched against the text in Box A.
Believe it or not, I know how to do the above! But, I am getting stuck on a configuration of this cgi program.
I need to configure the asterix button so that if someone enters the text: abcdefg
and the pattern: c*f
My program will find the first match (in this case cdef) as asterix needs to represent one or more letters.
I only come to this forum as a last ditch hope, please do not be offended but I have learnt if I am going to learn any kinda programming I have to keep on trying by myself! It is just I can configure the asterix to be replaced by one letter but not more than one.
Any help is much appreciated.
$newtext is just what was taken from parameter
---------------
my $patternit = $pattern ;
my @values = split(/\*/, $patternit);
foreach my $value (@values) {
}
print $query ->p("(8)$values[0]");
print $query ->p("(9)$values[1]");
$finalpattern = join '', $values[0],"[a-z]",$values[1];
print $finalpattern;
if ( $newtext =~ /$finalpattern/)
{
print $query ->p("An Important Match Was Found.");
}
else{
print $query ->p("No match was found");
}
$position2 = index($newtext,$finalpattern);
print "The match was found at position $position2<br>";
}
}
}
I want user to:
Enter text into box A
Enter a pattern into box B
Box B is matched against the text in Box A.
Believe it or not, I know how to do the above! But, I am getting stuck on a configuration of this cgi program.
I need to configure the asterix button so that if someone enters the text: abcdefg
and the pattern: c*f
My program will find the first match (in this case cdef) as asterix needs to represent one or more letters.
I only come to this forum as a last ditch hope, please do not be offended but I have learnt if I am going to learn any kinda programming I have to keep on trying by myself! It is just I can configure the asterix to be replaced by one letter but not more than one.
Any help is much appreciated.
$newtext is just what was taken from parameter
---------------
my $patternit = $pattern ;
my @values = split(/\*/, $patternit);
foreach my $value (@values) {
}
print $query ->p("(8)$values[0]");
print $query ->p("(9)$values[1]");
$finalpattern = join '', $values[0],"[a-z]",$values[1];
print $finalpattern;
if ( $newtext =~ /$finalpattern/)
{
print $query ->p("An Important Match Was Found.");
}
else{
print $query ->p("No match was found");
}
$position2 = index($newtext,$finalpattern);
print "The match was found at position $position2<br>";
}
}
}