Hi,

I'm stucked with a problem, hope somebody can help me. The problem is that i have a string with webpage source and i need to retrieve all the text instances between <pre> and </pre> tags, i already know how to retrive the first ocurrence using:

dim start as integer
dim end as integer
lenght as integer

start = htmlsource.indexof("<pre>") + 5
end = htmlsource.indexof("</pre>")

lenght = end - start


 MsgBox(htmlsource.Substring(start, lenght), vbokonly, "TESTING...")

but this code only retrieve the first instance, and i'm stucked without knowing how to move to the next instance until the end of the htmlsource string :(

i don't code in any language since near 12 years ago, can anybody help me?
It would be much appreciated.


by the way this is the source code of the webpage:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>NOTAMS for Lisbon Portela Airport</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/style/mobile.css" />
<meta name = "viewport" content = "width=device-width; initial-scale=1.0; user-scalable=0;" /> 
<meta name="description" content="NOTAMS for Lisbon Portela Airport." />
<meta name="keywords" content="cell phone,mobile,Lisbon Portela Airport,NOTAMS,Lisbon,Portugal,LIS,LPPT," />
<meta name="geo.position" content="38.7812995910645; -9.13591957092285" />
<meta name="geo.region" content="PT-11" />
<meta name="geo.placename" content="Lisbon, Portugal" />
</head>

<body>

<form action="/search.html" method="get">
<div>
<label>
<!--
<span class="note">Address, city, airport code or name:</span><br />
-->
<input onfocus="searchFocus(this);" onblur="searchBlur(this);" id="form.search.q" name="q" value="" />
</label>
<input type="submit" value="Search" />
</div>
<script type="text/javascript">
var hint = 'Code, city, address, etc.';

function searchFocus (textField) {
  if (textField.className == 'hint') {
    textField.className = '';
    textField.value = '';
  }
}

function searchBlur (textField) {
  if (textField.value == '') {
    textField.className = 'hint';
    textField.value = hint;
  }
}

var node = document.getElementById('form.search.q');
if (node.value == '' || node.value == hint) {
  node.value = '';
  searchBlur(node);
}
</script>
</form>

<p class="breadcrumbs">
<a href="/">OurAirports</a> »
<a href="/continents/EU/">Europe</a> »
<a href="/countries/PT/">Portugal</a> »
<a href="/countries/PT/11/">Lisbon District</a> »
Lisbon » <a href="/airports/LPPT/">Lisbon Portela Airport</a> » </p>
<h1>NOTAMS for Lisbon Portela Airport</h1>

<p class="note">NOTAMS may be missing, incomplete, or out of date.  Please confirm with an official source.</p>

<div>
<span class="label">NOTAM  A4259/11</span><br />
<pre>A4259/11 NOTAMN
Q) LPPC/QFDAS/I /M  /A /000/999/3846N00908W005
A) LPPT B) 1110290111 C) 1110311500 EST
E) AIRCRAFT PARKING INFORMATION SYSTEM (APIS) ON STAND 503 OUT OF 
SERVICE. MARSHALL ON SITE FOR ACFT PARKING PROCEDURES.
CREATED: 29 Oct 2011 01:12:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4258/11</span><br />
<pre>A4258/11 NOTAMN
Q) LPPC/QFDAS/I /M  /A /000/999/3846N00908W005
A) LPPT B) 1110290110 C) 1110311500 EST
E) AIRCRAFT PARKING INFORMATION SYSTEM (APIS) ON STAND 412 OUT OF 
SERVICE. MARSHALL ON SITE FOR ACFT PARKING PROCEDURES.
CREATED: 29 Oct 2011 01:11:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4230/11</span><br />
<pre>A4230/11 NOTAMR A3103/11
Q) LPPC/QMXLT/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110280332 C) 1201272359 EST
E) TWY B CLOSED ON THE LAST 130 METERS NORTHEAST PORTION DUE WIP. 
AREA 
SIGNALIZED WITH DAY AND NIGHT CLOSING MARKINGS AND FENCE BARRIER. 
CAUTION ADVISED.
CREATED: 28 Oct 2011 03:33:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4229/11</span><br />
<pre>A4229/11 NOTAMR A3087/11
Q) LPPC/QMPHW/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110280331 C) 1201272359 EST
E) MAX ACFT WING SPAN ON STAND 803 LIMITED TO 36.0M, DUE TO WIP.
CREATED: 28 Oct 2011 03:32:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4228/11</span><br />
<pre>A4228/11 NOTAMR A3082/11
Q) LPPC/QMPHW/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110280330 C) 1201272359 EST
E) ACFT TO STANDS 801, 802 AND 803 SHALL WAIT FOLLOW-ME GUIDANCE 
ABEAM 
TWY C DUE TO PAVEMENT REPAIRS WIP.
CREATED: 28 Oct 2011 03:31:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4227/11</span><br />
<pre>A4227/11 NOTAMR A3081/11
Q) LPPC/QMXHW/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110280328 C) 1201272359 EST
E) TWY B NOT PROVIDED WITH CENTRE LINE LIGHTS DUE TO ELECTRICAL 
SERVICES WIP.
CREATED: 28 Oct 2011 03:29:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4226/11</span><br />
<pre>A4226/11 NOTAMR A3083/11
Q) LPPC/QMNXX/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110280309 C) 1111302359 EST
E) MARSHALL AND FOLLOW-ME GUIDANCE ARE COMPULSORY FOR ALL ACFT WITH 
DESTINATION STANDS ON APRON 80.
CREATED: 28 Oct 2011 03:10:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4172/11</span><br />
<pre>A4172/11 NOTAMN
Q) LPPC/QCACF/IV/B  /AE/000/999/3859N00907W074
A) LPPT B) 1112150000 C) PERM
E) A/G FACILITY FREQ CHANGED AS FOLLOWS:
LISBOA TMA UPPER SECTOR PRIMARY FREQ 120.600MHZ AND 316.900MHZ.
LISBOA TMA LOWER SECTOR PRIMARY FREQ 120.250MHZ AND 316.900MHZ.
LISBOA APP SECTOR PRIMARY FREQ 119.100MHZ, SECONDARY FREQ 119.550MHZ.
LISBOA APP SECTOR 1 PRIMARY FREQ 119.100MHZ AND 316.900MHZ.
LISBOA APP SECTOR 2 PRIMARY FREQ 119.550MHZ AND 316.900MHZ.
REF AIP PORTUGAL ENR 2.1-12 AND 2.1-13.
CREATED: 26 Oct 2011 09:46:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4130/11</span><br />
<pre>A4130/11 NOTAMN
Q) LPPC/QFDAS/I /M  /A /000/999/3846N00908W005
A) LPPT B) 1110240744 C) 1110312359 EST
E) AIRCRAFT PARKING INFORMATION SYSTEM (APIS) ON STAND 206 OUT OF 
SERVICE. MARSHALLER ON SITE FOR ACFT PARKING PROCEDURES.
CREATED: 24 Oct 2011 07:45:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4129/11</span><br />
<pre>A4129/11 NOTAMN
Q) LPPC/QFDAS/I /M  /A /000/999/3846N00908W005
A) LPPT B) 1110240736 C) 1110312359 EST
E) AIRCRAFT PARKING INFORMATION SYSTEM (APIS) ON STAND 117 OUT OF 
SERVICE. MARSHALL ON SITE FOR ACFT PARKING PROCEDURES.
CREATED: 24 Oct 2011 07:38:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4065/11</span><br />
<pre>A4065/11 NOTAMN
Q) LPPC/QMNHW/IV/BO /A /000/999/3846N00908W005
A) LPPT B) 1110171020 C) 1112312359 EST
E) CAUTION IS ADVICE FOR POSSIBLE F.O.D. (FOREIGN OBJECT DAMAGE) DUE
TO WIP ON APRON C EDGES. ALSO CAUTION REQUIRED FOR MEN AND EQUIPMENT
WORKING.
CREATED: 17 Oct 2011 10:21:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A4015/11</span><br />
<pre>A4015/11 NOTAMR A3993/11
Q) LPPC/QOBCE/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1110122129 C) 1201122359 EST
E) OBSTACLE MAST NEAR LISBOA AD PSN 385358N0091140W SERRA DE 
MONTACHIQUE HEIGHT 45M ELEVATION 454M. OBSTACLE NOT SIGNALIZED.
CREATED: 12 Oct 2011 21:31:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3911/11</span><br />
<pre>A3911/11 NOTAMN
Q) LPPC/QPATT/I /BO /A /000/999/3846N00908W005
A) LPPT B) 1111170000 C) 1112010000
E) TRIGGER NOTAM - PERM AIRAC AIP AMDT 005/11 WEF 17 NOV 2011.
LPPT AD - NEW RNAV STAR PROCEDURES - CONTINUOUS DESCEND OPERATIONS.
CREATED: 06 Oct 2011 10:00:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3820/11</span><br />
<pre>A3820/11 NOTAMR A2679/11
Q) LPPC/QMXLT/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1109292157 C) 1112292359 EST
E) RWY21 RAPID EXIT TWY HS NOT CODED BY DISTANCE INDICATOR LIGHTS.
CREATED: 29 Sep 2011 21:58:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3819/11</span><br />
<pre>A3819/11 NOTAMR A2678/11
Q) LPPC/QMXLT/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1109292156 C) 1112292359 EST
E) RWY03 RAPID EXIT TWY HN NOT CODED BY DISTANCE INDICATOR LIGHTS.
CREATED: 29 Sep 2011 21:58:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3818/11</span><br />
<pre>A3818/11 NOTAMR A2677/11
Q) LPPC/QMRLT/IV/NBO/A /000/999/3846N00908W005
A) LPPT B) 1109292153 C) 1112292359 EST
E) DUE TO PAVEMENT CONDITIONS, PILOTS SHALL NOT USE RWY 03 TAKE-OFF 
POSITION 1.
CREATED: 29 Sep 2011 21:56:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3734/11</span><br />
<pre>A3734/11 NOTAMN
Q) LPPC/QOBCE/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1109231700 C) 1112232359
E) CRANE ERECTED 1,6KM SE OF LISBOA AD REFERENCE POINT LOCATED
384612,89N0090730,83W, WITH 50 METERS LONG, HGT 45 METERS/ELEV 127 
METERS. NIGHT AND DAY SIGNALIZED.)
DUPE
CREATED: 23 Sep 2011 15:47:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3733/11</span><br />
<pre>A3733/11 NOTAMN
Q) LPPC/QOBCE/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1109231700 C) 1112232359
E) CRANE ERECTED 1,5KM SE OF LISBOA AD REFERENCE POINT LOCATED
384612,79N0090730,73W, WITH 50 METERS LONG, HGT 45 METERS/ELEV 138 
METERS. NIGHT AND DAY SIGNALIZED.
CREATED: 23 Sep 2011 15:43:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3684/11</span><br />
<pre>A3684/11 NOTAMN
Q) LPPC/QFMXX/IV/BO /AE/000/999/3846N00908W005
A) LPPT B) 1109201800 C) PERM
E) METEOROLOGICAL WATCH OFFICE (MWO):

NEW ADDRESS: CENTRO DE PREVISAO E VIGILANCIA METEOROLOGICA
             RUA C - AEROPORTO DE LISBOA
             1749-077 LISBOA
             PORTUGAL
NEW PHONE:  +351.21.8474583
NEW E-MAIL: MET.AERO(AT)METEO.PT
NEW FAX:    +351.21.8402370

THE TREND FORECAST IS REMOVED FROM ROUTINE AND SPECIAL MET REPORTS.
REF AIP PORTUGAL GEN 3.5 AND LPPT AD 2-11.
CREATED: 20 Sep 2011 16:33:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3410/11</span><br />
<pre>A3410/11 NOTAMR A2226/11
Q) LPPC/QOBCE/IV/M  /AE/000/010/3846N00908W005
A) LPPT B) 1108261624 C) 1111282300 EST
E) CRANE ERECTED 2KM SW OF LISBOA AD LOCATED AT 384513N0091000W, 
WITH 
50 METERS LONG, HGT 154,5 METERS/ELEV 241,5 METERS. NIGHT AND DAY 
SIGNALIZED.
CREATED: 26 Aug 2011 16:25:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3089/11</span><br />
<pre>A3089/11 NOTAMN
Q) LPPC/QMPXX/IV/BO /A /000/999/3846N00908W005
A) LPPT B) 1107270000 C) PERM
E) APRONS, TAXIWAYS AND CHECK LOCATIONS DATA, ITEM 5 AMENDED TO:
STAND   INS COORDINATES      ELEVATION  ACFT TYPE   PUSH BACK TO
                              (M/AMSL)  (CRITICAL)  TAXIWAY/TAXILANE
 801   384646.31N0090749.07W     98M      B763            B
 802   384647.60N0090747.01W     98M      B763            B
 803   384649.17N0090745.79W     97M      B763            B
 804   384650.44N0090744.27W     97M      A321            B
 805   384651.29N0090742.21W     97M      A321            B
 806   384652.57N0090742.50W     97M      A321            B 
 REF AIP PORTUGAL LPPT AD 2.8 ITEM 5.
CREATED: 26 Jul 2011 16:16:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3068/11</span><br />
<pre>A3068/11 NOTAMN
Q) LPPC/QMXXX/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1107251524 C) PERM
E) CATEGORY II/III OPERATIONS. TAXI, GENERAL: READ TAXI INSTRUCTIONS 
WILL BE SUPPORTED BY THE CONVENIENT SWITCHED ON/OFF OF TAXIWAY 
CENTRE LINE LIGHTS (GREEN) AND STOP BAR LIGHTS (RED) .
SO, PILOTS SHALL STOP AND REQUEST FURTHER INSTRUCTIONS AT ANY STOP 
BAR LIGHTED, AS WELL AS AT ANY SEGMENT OF TAXIWAY CENTRE LINE 
LIGHTS, UNLIGHTED.
TAXIWAY CENTRE LINE LIGHTS WITHIN LOCALIZER SENSITIVE AREA ARE CODED 
BY ALTERNATE YELLOW AND GREEN LIGHTS. REF AIP PORTUGAL LPPT AD 
2.20.7 PARAGRAPH 2.20.7.6.1
CREATED: 25 Jul 2011 15:26:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3067/11</span><br />
<pre>A3067/11 NOTAMN
Q) LPPC/QLYXX/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1107251508 C) PERM
E) OTHER LIGHTING, SECONDARY POWER SUPPLY. TWY EDGE AND CENTRE LINE 
LIGHTING: READ TWY CENTRE LINE, ALL AERODROME TAXIWAYS EXCEPT TWY D 
ON APRON 70, ARE PROVIDED WITH CENTRE LINE LIGHTING INSTEAD OF TWY 
CENTRE LINE. REF AIP PORTUGAL LPPT AD 2.15 ITEM 3.
CREATED: 25 Jul 2011 15:10:00 
SOURCE: EUECYIYN</pre>
</div><div>
<span class="label">NOTAM  A3066/11</span><br />
<pre>A3066/11 NOTAMN
Q) LPPC/QLXXX/IV/M  /A /000/999/3846N00908W005
A) LPPT B) 1107251454 C) PERM
E) SURFACE MOVEMENT GUIDANCE AND CONTROL SYSTEM AND MARKINGS, ON 
REMARKS ADD FOLLOWING INFORMATION: TAXIWAY CENTRE LINE LIGHTS NOT 
PROVIDED ON TAXIWAY DELTA. REF AIP PORTUGAL LPPT AD 2.9 ITEM 4.
CREATED: 25 Jul 2011 14:55:00 
SOURCE: EUECYIYN</pre>
</div>
<div class="footer">
Visit <a href="http://www.ourairports.com/">OurAirports</a> on the web for maps and more.
</div>
<img src="/ga.php?utmac=UA-2547585-4&amp;utmn=1160201895&amp;utmr=http%3A%2F%2Fourairports.mobi%2Fairports%2FLPPT%2F&amp;utmp=%2Fairports%2FLPPT%2Fnotams.html&amp;guid=ON" />

</body>

</html>

Thanks,
Bug

EUREKA!!! I finally got it. I made a while loop where after an instance ocurrs i just trimmed the string from the begin to end value.


Thanks anyway,
Bug_

You can use a loop/end loop to still searching while <pre> is found.
Also you need to use the last position of the </pre> to start the new search from that point.
This is an untested excample:

start = htmlsource.indexof("<pre>")
Loop While start <> -1
   start += 5
   end = htmlsource.indexof("</pre>", start)
   lenght = end - start
   MsgBox(htmlsource.Substring(start, lenght), vbokonly, "TESTING...")
   start = htmlsource.indexof("<pre>", end + 6)
End Loop

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.