Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Regular Expression Question

Expand Messages
  • Charles K. Clarkson
    From: Mike D ... use HTML::TokeParser; my $frequency; my $p = HTML::TokeParser- new( in.html ) || die Can t open: $! ; while
    Message 1 of 2 , Mar 1, 2001
      From: "Mike D" <mikedpan@...>
      : Hello,
      : I have a log file of HTML code and I need to find a
      : string and set a PERL variable equal to the value that
      : follows the string. So the HTML code looks something
      : like this:
      : <TR>
      : <TD>frequencyBand</TD>
      : <TD>:</TD>
      : <TD>ota1800</TD>
      : </TR>
      : So I need to grep for "frequencyBand" and get the
      : value "ota1800" and set it equal to a PERL variable.

      use HTML::TokeParser;

      my $frequency;
      my $p = HTML::TokeParser->new("in.html") || die "Can't open: $!";

      while ($p->get_tag("td") ) {
      if ( $p->get_trimmed_text =~ /frequencyBand/ ) {
      $frequency = $p->get_trimmed_text;

      Charles k. Clarkson
    • Nathan.Jeffrey@dhs.vic.gov.au
      Well, you d need something to change the 4 to a 9 in that example :-) Try... $itemcode =~ s/B$//; # $ matches end of string N libertyhosting
      Message 2 of 2 , Mar 6, 2003
        Well, you'd need something to change the 4 to a 9 in that example :-)


        $itemcode =~ s/B$//; # $ matches end of string


        "libertyhosting" <greg@...>
        07/03/2003 09:21 AM
        Please respond to perl-beginner

        To: perl-beginner@yahoogroups.com
        Subject: [PBML] Regular Expression Question

        Hi All,

        I need to to drop the "B" of the end of a string. What would be the
        best way to do this.

        For Ex.
        $itemcode = AW-304B

        I need it to be AW-309.

        Any help is greatly appreciated.


        Unsubscribing info is here:

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


        This email contains confidential information intended only for the person named above and may be subject to legal privilege. If you are not the intended recipient, any disclosure, copying or use of this information is prohibited. The Department provides no guarantee that this communication is free of virus or that it has not been intercepted or interfered with. If you have received this email in error or have any other concerns regarding its transmission, please notify Postmaster@...
      Your message has been successfully submitted and would be delivered to recipients shortly.