Extract anchor tag href from string javascript/jquery
<p>I've a requirement where I need to <code>extract</code> the <code>1st href</code> from a <code>string</code>.</p>

<p>Let's say I've a string this way :</p>

<pre><code>var LinkString="Google Link Is:&lt;a href='www.Google.com' target='_blank' style='text-decoration:none; color:#000000;'&gt;URL&lt;/a&gt;";
</code></pre>

<p>Now I need to <code>find all the anchor tags</code> from that <code>string</code> and <code>extract the first anchor tag's href</code>.</p>

<p>I've followed this sample from <a href="https://stackoverflow.com/questions/36370474/how-to-extract-full-anchor-tag-from-var-in-javascript">here</a> and have tried finding the anchor tag from the string.</p>

<p>But I'm unable to get the first element's href.</p>

<pre><code>var LinkString="Google Link Is:&lt;a href='www.Google.com' target='_blank' style='text-decoration:none; color:#000000;'&gt;URL&lt;/a&gt;";
    var output = LinkString.split(/(?=&lt;a)/)[1];
</code></pre>

<p>I've also tried <code>creating a DOM element</code> from the <code>output anchor tag</code> but unable to get the exact href by following the procedure from <a href="https://stackoverflow.com/a/494348/2027813">here</a> </p>

<p>My requirement is to get the <code>Google.com</code> as a final output.</p>

<p>Can anyone help me getting the href?</p>