I'm trying to extract data from an html page as to store them in a String array
In the HTML page values are shown like this
<tbody>
<tr>
<td style="width: 14%;">88055</td>
<td style="width: 19%;" class="gris">Ville</td>
<td style="width: 33%;"><a href="repertoire-des-municipalites/fiche/municipalite/88055/" >Amos</a></td>
<td style="width: 34%;"><a href="repertoire-des-municipalites/fiche/mrc/880/" >Abitibi</a></td>
</tr>
<tr>
<td style="width: 14%;">85080</td>
<td style="width: 19%;" class="gris">Village</td>
<td style="width: 33%;"><a href="repertoire-des-municipalites/fiche/municipalite/85080/" >Angliers</a></td>
<td style="width: 34%;"><a href="repertoire-des-municipalites/fiche/mrc/850/" >Témiscamingue</a></td>
</tr>
<tr>
<td style="width: 14%;">87050</td>
<td style="width: 19%;" class="gris">Municipalité</td>
<td style="width: 33%;"><a href="repertoire-des-municipalites/fiche/municipalite/87050/" >Authier</a></td>
<td style="width: 34%;"><a href="repertoire-des-municipalites/fiche/mrc/870/" >Abitibi-Ouest</a></td>
</tr>
I need to extract only the string where the href = Municipality
witch means Amos ,Angliers , etc... and store them into an array of string
So far I have tried this and I'm lost
public static final String EXPRESSION = "";//How to write the regex expression?
String [] data = new String [20]
URL url = new URL("http://myur.com");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((ligne = in.readLine()) != null) {
//What to write here?
}
in.close();
P.S : I'm aware the best method is to use an HTML parser instead but I'm really forced to apply this way
Much appreciation ,
Bass