I want to search for all hyperlinks in a large String with specific keywords in it. The hyperlink shall contain the following keywords: manufacture's name (e.g. Samsung), and download.
The structure of the String is like following:
<h2><a href="https://www.samsung.com/semiconductor/minisite/ssd/product/consumer/magician/" h="ID=SERP,5141.1">
Samsung Magician Software | Samsung V-NAND …</a></h2><div class="b_suffix b_secondaryText nowrap">
<a href="http://www.microsofttranslator.com/bv.aspx?ref=SERP&br=ro&mkt=nl-NL&dl=nl&lp=EN_NL&
;a=https%3a%2f%2fwww.samsung.com%2fsemiconductor%2fminisite%2fssd%2fproduct%2fconsumer%2fmagician%2f" h="ID=SERP
,5148.1">Deze pagina vertalen</a></div></div><div class="b_caption"><div class="b_attribution b_nav" u="0N|5131|
4627393552323160|A_CGcDrlDvI4S9DANesILYWPEhC2j7ly"><cite>https://www.<strong>samsung</strong>.com/.../minisite/
ssd/product/consumer/<strong>magician</strong></cite><span class="c_tlbxTrg"><span class="c_tlbxH" H="BASE:CACHE
DPAGEDEFAULT" K="SERP,5142.1"></span></span></div><p><strong>Samsung Magician</strong> software is designed to
help you manage your <strong>Samsung</strong> SSD with a simple, intuitive user interface. <strong>Download
/strong> files & find supported models.</p></div><div Class="dlCollapsedCnt"><div class="b_vlist2col b_deep"
><ul><li><h3 class="deeplink_title"><a href="https://www.samsung.com/semiconductor/minisite/ssd/product/consumer
/860evo" h="ID=SERP,5345.1">860 EVO</a></h3><p>The SSD to trust. The newest edition to the world’s best-selling*
SATA SSD series, the …</p></li></ul><ul></ul></div></div><form class="sc_rf dlsbox b_externalSearch b_divsec
dlCollapsed" name="sc_rf dlsbox b_externalSearch b_divsec dlCollapsed5349" onsubmit="sa_ResubmitForm.Resubmit
(this, 'http:\/\/www.samsung.com\/nl\/function\/search\/espsearchResult?keywords=&input_keyword=%query');
return false;"><input id="sc_rf dlsbox b_externalSearch b_divsec dlCollapsed5349_si" type="hidden" value="SERP,
5349.1"/> <input class="b_hide" value="ctxtb" id="h_c0" name="h_c0" /><input type="text" id="c0" name="query"
maxlength="100" style="width:466px" class="ctxt" qi="1" data-gt="" placeholder="Zoeken in samsung.com" onfocus="
sj_evt.fire('LogTextBoxFocus', 'SERP','5515.1')" /> <span id="3C65B3_3_btn" class="cbtn" data-wire="I;button_
init;; |" data-appns="SERP" data-k="5517.1"><input type="submit" name="submit" id="sb_submit" value="Zoeken"
style="width:100px" /></span></form></li><li class="b_algo"><div class="b_title"><h2>
<a href="https://www.samsung.com/semiconductor/minisite/ssd/download/tools/" h="ID=SERP,5156.1">
Actually only the first hyperlink is observed and the keyword "download" is missing. So my output is the hyperlink https://www.samsung.com/semiconductor/minisite/ssd/product/consumer/magician/
instead of https://www.samsung.com/semiconductor/minisite/ssd/download/tools/
Here is my actual code:
String strStart = "<a href=\"";
String strEnd = "\" h=\"ID=";
if (stringsource.Contains(strStart) &&
stringsource.Contains(strEnd) &&
stringsource.Contains(manufacture))
{
int Start, End;
Start = stringsource.IndexOf(strStart, 0)+strStart.Length;
End = stringsource.IndexOf(strEnd, Start);
Console.WriteLine("Text: " + stringsource.Substring(Start, End - Start));
String substring = stringsource.Substring(Start, End - Start);
}