I have an arraylist:
List<String> lines = new ArrayList<String>();
which contains the html of a webpage.
I made an arraylist 'resList' which contains the searched for string "abcde" and prints out to the console the said 6 lines of html:
ArrayList<String> resList = new ArrayList<String>();
String searchString = "(?i).*abcde.*";
for (String curVal : lines){
if (curVal.matches(searchString)){
resList.add(curVal);
System.out.println(items);
OUTPUT
<span class="bl-title"> <a href="abcdefPHOBIA_00">ACRO - abcdefPHOBIA_00</a>
<span class="bl-title"> <a href="abcdefPHOBIA_11">ACRO - abcdefPHOBIA_11</a>
<span class="bl-title"> <a href="abcdefPHOBIA_22">ACRO - abcdefPHOBIA_22</a>
<span class="bl-title"> <a href="abcdefPHOBIA_33">ACRO - abcdefPHOBIA_33</a>
<span class="bl-title"> <a href="abcdefPHOBIA_44">ACRO - abcdefPHOBIA_44</a>
<span class="bl-title"> <a href="abcdefPHOBIA_55">ACRO - abcdefPHOBIA_55</a>
I would like to read all the strings:
abcdefPHOBIA_00, abcdefPHOBIA_11, abcdefPHOBIA_22, abcdefPHOBIA_33, abcdefPHOBIA_44, abcdefPHOBIA_55
into an arrayList.
Tried split(" - ") and then tried startsWith() but it is not exactly what I want. Also tried a pattern with a regex but could not seem to make much progress.
What would be helpful is which way would be the most beneficial in terms of improving long term and also to get this thing done!
Apologies if the Question isn't detailed enough in advance.