Front page | perl.beginners |
Postings from March 2002
Re: finding text
Thread Previous
|
Thread Next
From:
bob ackerman
Date:
March 27, 2002 21:57
Subject:
Re: finding text
Message ID:
B6E5E533-4210-11D6-AEED-003065428126@pacbell.net
here is my code to parse a line:
$_ = "<tr><td>abc</td><td>def</td></tr>"; # sample of a row
@arr = /<td>(.*?)<\/td>/g; # get chars between'td' tag and
endtag into an array
print $_,"\n" for @arr; # just checking result
On Wednesday, March 27, 2002, at 09:48 PM, bob ackerman wrote:
> how do you mean to identify the row you want to capture?
> or are you saying you have the row and just want to know how to parse the
> line to get text between <td> and </td>?
>
>
> On Wednesday, March 27, 2002, at 09:41 PM, Michael Gargiullo wrote:
>
>> I use LWP::Simple to get an HTML page. I only want to keep one table row,
>> and then only the data from the row in seperate fields.
>>
>> For example:
>>
>> <html>
>> <head>
>> <title>page 1</title>
>> </head>
>> <body>
>> <table><tr><td>some text</td></tr><tr><td>a few links</td></tr></table>
>> <table>
>> <tr><td>some text</td><td>some text</td></tr>
>> <tr><td>some text</td><td>a few links</td></tr>
>> <tr><td> THE DATA I WANT</td><td> MORE DATA I WANT</td>
>> </table>
>>
>> I want to be able to set vars to each of the data pieces on the page I
>> want
>> to keep.
>>
>> i know i should do some pattern matching of some sort, but need some
>> sort of
>> kick start. This is my first attempt at writting a perl script to parse
>> through text.
>>
>>
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>> For additional commands, e-mail: beginners-help@perl.org
>>
>
>
> -- To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
>
Thread Previous
|
Thread Next