Search code examples
htmlnotepad++

Copy-paste multiple values to their placeholders notepad++


Suppose markup (many lines with same structure)

<a href="">xxx</a>
<a href="">yyy</a>
<a href="">zzz</a>

What is the best way to achive this? (copy-paste into href="")

<a href="xxx">xxx</a>
<a href="yyy">yyy</a>
<a href="zzz">zzz</a>

My thoughts: execute JS then copy html from browser, but seems a bit cumbersome. Any notepad++ solution?

$('a').each(function(){
    $(this).attr('href',$(this).text());
});

Solution

  • You could do the following replacement in regex mode:

    Find:    <a href="">(.*?)</a>
    Replace: <a href="$1">$1</a>
    

    Here is a working regex demo.