eweaverp has asked for the wisdom of the Perl Monks concerning the following question:
The results should be 249 64265 271 64243 (for the second, smaller block) and 11 1 370 360 (for the first block). I have tried this, where $id is the <a name=> number:><a name = 32169281></a><a href="http://www.ncbi.nlm.nih.gov/entrez/qu +ery.fcgi?cmd=Retrieve&db=Nucleotide&list_uids=32169281&dopt=GenBank" +>emb|AJ544060.1|GGA544060</a> Gallus gallus mRNA for granzyme A precu +rsor (GZMA gene) Length = 1100 Score = 721 bits (360), Expect = 0.0 Identities = 360/360 (100%) Strand = Plus / Plus + Query: 11 catgggtgtttttttcactctgtccacctctgctgccatcgttctcctgatacttcctg +g 70 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 1 catgggtgtttttttcactctgtccacctctgctgccatcgttctcctgatacttcctg +g 60 + Query: 71 agatttgtgcgtggatatcattggaggacatgaagtagcaccacactcaagaccattta +t 130 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 61 agatttgtgcgtggatatcattggaggacatgaagtagcaccacactcaagaccattta +t 120 + Query: 131 ggccatgctcaaaggaaaagaattttgtggaggagctttgatcaagccaagctgggtgt +t 190 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 121 ggccatgctcaaaggaaaagaattttgtggaggagctttgatcaagccaagctgggtgt +t 180 + Query: 191 aacagctgctcattgcaatctgaagggaggcagagttattcttggagcccattcacgga +c 250 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 181 aacagctgctcattgcaatctgaagggaggcagagttattcttggagcccattcacgga +c 240 + Query: 251 aaaaagagaagaagaagaacaggttattgagattgcagaagaaattcgctacccagact +a 310 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 241 aaaaagagaagaagaagaacaggttattgagattgcagaagaaattcgctacccagact +a 300 + Query: 311 ctgtcccgaaagaaaggaacatgacattatgctgttgaagcttaagaaaagagcaaaaa +t 370 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +| Sbjct: 301 ctgtcccgaaagaaaggaacatgacattatgctgttgaagcttaagaaaagagcaaaaa +t 360 ><a name = 16647294></a><a href="http://www.ncbi.nlm.nih.gov/entrez/qu +ery.fcgi?cmd=Retrieve&db=Nucleotide&list_uids=16647294&dopt=GenBank" +>gb|AC016999.8|</a> Homo sapiens BAC clone RP11-40B20 from 2, complet +e sequence Length = 93778 Score = 46.6 bits (23), Expect = 0.028 Identities = 23/23 (100%) Strand = Plus / Minus Query: 249 acaaaaagagaagaagaagaaca 271 ||||||||||||||||||||||| Sbjct: 64265 acaaaaagagaagaagaagaaca 64243
But this doesn't grab the last query properly. What can I do that avoids getting the wrong 'last' numbers? I need them from the same number block, and combinations of greedy/non-greedy matching aren't working out for me, I either get partial results (not the true last ones) or last ones from the last block in the page.my @positions = $string =~ m/<a name = $id>.*?Query: (\d+).*?Sbjct +: (\d+).*?<\/pre>/s; push (@positions, $string =~ m/<a name = $id>.*?Query: \d+\s+[a-z] ++ (\d+)\n.*?\nSbjct: \d+\s+[a-z]+ (\d+)\n<\/pre>/s);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex perplexity
by pzbagel (Chaplain) on Jun 30, 2003 at 19:14 UTC | |
by eweaverp (Scribe) on Jun 30, 2003 at 22:24 UTC | |
by eweaverp (Scribe) on Jun 30, 2003 at 22:30 UTC | |
by eweaverp (Scribe) on Jun 30, 2003 at 22:50 UTC | |
|
Re: Regex perplexity
by Skeeve (Parson) on Jul 01, 2003 at 06:28 UTC |