Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: regex with variable input

by spq (Friar)
on Aug 10, 2004 at 01:23 UTC ( #381425=note: print w/replies, xml ) Need Help??

in reply to regex with variable input

First of all, does offer any sort of batch download, or text based save that could be used?

I'm guessing your looking to do this in a (semi) automated manner, and starting from saving as text from your web browser wont help in the long run, since your scripting the fetch? I also might suggest that you may want to consider contacting the web site maintainers. They may not be thrilled about getting hammered by your script, and may be very open to helping find an easier way to provide this information to you instead.

That being said, I used wget to download the page and wrote this code which seems to capture what you want (this is a quick translation from a command line test, and in no way should be considered production ready or tested).

while (<>) { chomp; if(/CANDIDATE (\d+)/){ $cand = $1; @acc = () } # if candidate line elsif (m{} && m{(\w+)</A>}) { push(@acc,$1); } # else if ncbi accession # elsif (m{R-score</A>\s*=\s*(\S+);}) { print "$cand\t", join(",",@acc), "\t$1\n"; } # else if R-score, print this candidates info } # while reading web page

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://381425]
[choroba]: Pamela Anderson?
[choroba]: erix: I'm proud to be from a nation that also does one thing well
[LanX]: ah yes! And he called her Kit and she could talk while a light was going from her left to right eye and back...
[erix]: choroba: pretty impressive! :)
LanX imagines which nations would be dominating if the winter olympics were invented in East Asia
[LanX]: Corion: and that's the clue how Germany can dominate Handball tournaments, just continuing the domestic league and forbidding the best players of the world to attend :)
LanX (which would be a good scheme for England and football too)
[LanX]: If "Canada will play the Czech Republic for bronze on Saturday", that means Germany will play Syria in disguise...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-02-23 16:38 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (303 votes). Check out past polls.