<p>Im trying to craft a regex that only returns <code>&lt;link&gt;</code> tag hrefs</p>
<p>Why does this regex return all hrefs including &lt;a hrefs?</p>
<pre><code>(?&amp;lt;=&amp;lt;link\s+.*?)href\s*=\s*[\'\&quot;][^\'\&quot;]+
</code></pre>
<pre class="lang-html prettyprint-override"><code>&lt;link rel=&quot;stylesheet&quot; rev=&quot;stylesheet&quot; href=&quot;idlecore-tidied.css?T_2_5_0_228&quot; media=&quot;screen&quot;&gt;
&lt;a href=&quot;anotherurl&quot;&gt;Slash Boxes&amp;lt;/a&gt;
</code></pre>

```
```
/(?<=<link\s+.*?)href\s*=\s*[\'\"][^\'\"]+[^>]*>/
```
```
i'm a little shaky on the back-references myself, so I left that in there. This regex though:
```
```
/(<link\s+.*?)href\s*=\s*[\'\"][^\'\"]+[^>]*>/
```
```
...works in my Javascript test.