Thread HTML file nach infos duchsuchen od. parsen?? (22 answers)
Opened by Gast at 2007-10-23 03:13

renee
 2007-11-04 13:09
#101817 #101817
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Ja,jetzt ist es klar und so lässt sich auch viel besser arbeiten:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl

use strict;
use warnings;
use Web::Scraper;

my $content = do{ local $/; <DATA> };
my $parser  = scraper{
    process 'tr', 'elements[]' => scraper{
        process 'input[type="checkbox"]', 'Ladung' => '@value';
        process 'tt', 'infos[]' => 'TEXT';
    };
};

my $result = $parser->scrape( $content );

for my $element ( @{ $result->{elements} } ){
    my ($ladung) = $element->{Ladung} =~ m!,(.*?)\)!;
    my ($scan)   = $element->{Ladung} =~ m!FinneganScanNumber%3a%20(\d+)!;
    my ($massobs,$massexp,$masscalc,$info)  = @{ $element->{infos} }[1,2,3,-1];
    my ($seq,$mod) = split /\s*\+\s*/, $info;
    
    print qq~
Ladung:          $ladung
FinneScanNumber: $scan
Mass Observed:   $massobs
Mass exp:        $massexp
Mass calc:       $masscalc
Sequence:        $seq
Modification:    $mod

~;
}


__DATA__
<TR>
<TD align=right><INPUT type=checkbox CHECKED 
value="1060.542634 from(531.278593,2+) title(Elution%20from%3a%20777%2e777%20to%20777%2e777%20period%3a%20dimer_02%2eraw%20experiment%3a%201%20cycles%3a%201%20precIntensity%3a%2080142%2e0%20FinneganScanNumber%3a%203539) query(5104)" 
name=QUE></TD>
<TD align=right><TT><A 
onmouseover="statusString = h1_q5104; if (!browser_EXCLUDE) activateEl('Q5104', event)" 
onmouseout=clearEl() 
 href="http://test.de" 
target=_blank>5104</A>  </TT></TD>
<TD align=right><TT><FONT 
color=#ff0000><B>531.27859  </B></FONT></TT></TD>
<TD align=right><TT><FONT 
color=#ff0000><B>1060.54263  </B></FONT></TT></TD>
<TD align=right><TT><FONT 
color=#ff0000><B>1060.54001  </B></FONT></TT></TD>
<TD noWrap align=right><TT><FONT 
color=#ff0000><B>0.00263 </B></FONT></TT></TD>
<TD align=right><TT><FONT 
color=#ff0000><B>0  </B></FONT></TT></TD>
<TD noWrap align=right><TT><FONT 
color=#ff0000><B>(19) </B></FONT></TT></TD>
<TD noWrap align=right><TT><FONT 
color=#ff0000><B>2.4 </B></FONT></TT></TD>
<TD align=right><TT><FONT 
color=#ff0000><B>1  </B></FONT></TT></TD>
<TD noWrap><TT><FONT color=#ff0000><B>R.TLLEGEESR.M + di-MetCarboxylation 
(R)</B></FONT></TT></TD></TR>
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread HTML file nach infos duchsuchen od. parsen??