Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p><strong>The SubString() Option</strong></p> </blockquote> <p>As noted by Teoman Soygul, there is a SubString() Option, which I don't know if it is slower or faster as I did not test them side by side.</p> <p>Now, this is not properly disected into sub methods but should give you the general idea.<br> I just use a <code>ReadOnlyCollection</code> cause it is what I'm used to when no further manipulation of the list is required. Change it to what ever output list type you like.</p> <p>The <code>someText</code> variable is most likely going to end up a paramter of <code>GetLinks</code> off course.</p> <pre><code>public ReadOnlyCollection&lt;string&gt; GetLinks() { string startingText = "href=''"; string endText = "''&gt;"; string stopText = "Fixed_String"; string someText = @"what is this text &lt;a href=''/link/i/want''&gt;somenormallink&lt;/a&gt; some random text &lt;a href=''/another link/i/want''&gt;Fixed_String&lt;/a&gt; some more radnom txt "; List&lt;string&gt; myLinks = new List&lt;string&gt;(); string[] rawLinks = someText.Split(new string[] { "&lt;a " }, StringSplitOptions.None); foreach (string rawLink in rawLinks) { if (!rawLink.StartsWith(startingText)) { continue; } myLinks.Add(rawLink.Substring(startingText.Length, rawLink.IndexOf(endText, 1) - startingText.Length)); if (rawLink.Contains(stopText)) { break; } } return new ReadOnlyCollection&lt;string&gt;(myLinks); } </code></pre> <p>That Results in a Collection containing the links:<br> <img src="https://i.stack.imgur.com/4TP37.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload