38 users online (2 members and 36 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 5
  2. Matching Case    Forum: PHP Forum
    Replies: 2
  3. Matching definite articles etc    Forum: CGI Perl Forum
    Replies: 0
  4. Simple Pattern Matching help    Forum: CGI Perl Forum
    Replies: 3
  5. Matching a certain date format from a String?    Forum: CGI Perl Forum
    Replies: 0
  1. #1
    sdslrn123's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2006
    Posts
    1

    Pattern Matching

    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 http://www.tek-tips.com/viewthread.cfm?qid=1203889&page=1#

    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 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) {
    }
    http://www.tek-tips.com/viewthread.cfm?qid=1203889&page=1#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>";
    }
    }
    }

  2. #2
    nishanth's Avatar
    Disabled

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    4

    Re: Pattern Matching

    Hello,

    I know its too late.
    Still.
    Have you tried printing $& just below the regex matching sentence.
    This will print the terms that were matched in the regex.

    Regards
    Nishanth



Tags for this Thread