On-the-fly modifications of the links according to a set of rules (Greasekit / Javascript)
<p>I have an HTML page with loads of entries like this:</p>

<pre><code>&lt;a href="https://www.example.co.uk/gp/wine/product?ie=UTF8&amp;amp;asin=123456789&amp;amp;tab=UK_Default" class="PrmryBtnMed"
</code></pre>

<p>I want to replace all this links so they instead are
    <a href="https://www.example.co.uk/gp/wine/order?ie=UTF8&amp;asin=1233456789" rel="nofollow">https://www.example.co.uk/gp/wine/order?ie=UTF8&amp;asin=1233456789</a></p>

<p>So, it's quite a complicated search and replace. These are the instructions for a human:
1. Look at the URL. Only make a note of the number after 'asin='. (Forget everything before that and everything after that)
2. Then, form a new URL, using this ASIN. It will ALWAYS start like this:</p>

<pre><code>https://www.example.co.uk/gp/wine/order?ie=UTF8&amp;asin= 
</code></pre>

<p>with the number stuck on the end to form:</p>

<pre><code>https://www.example.co.uk/gp/wine/order?ie=UTF8&amp;asin=123456789
</code></pre>

<p>Kindly note</p>

<ul>
<li>rather than modifying the existing buttons, it would also be acceptable to add a new button [or link] near the original buttons</li>
<li>both the original and new links point to the same domain</li>
<li>I'm using Greasekit on a SSB called FluidApp, but I can switch to Greasemonkey on FireFox. </li>
</ul>

<p>I've just watched 40 JavaScript tutorial videos - man this language is hard! This seems extremely difficult. I would hugely appreciate any help/pointers. </p>
