Regex in Notepad++ to move contents of an element to an attribute value -
i'm trying solve regex riddle. let's have rows of hrefs looking this:
<a href="http://domain.com/5et46ffd5e3wr23">anchor1.in</a> <a href="http://domain.com/6utr4dghj6wfl">an3.php</a> <a href="http://domain.com/k543sk6k3f6hj">setup.exe</a>
what want regex (or other solution) take href
title , copy on actual url foward slash in front of it.
a successful result become:
<a href="http://domain.com/5et46ffd5e3wr23/anchor1.in">anchor1.in</a> <a href="http://domain.com/6utr4dghj6wfl/an3.php">an3.php</a> <a href="http://domain.com/k543sk6k3f6hj/setup.exe">setup.exe</a>
if can solve please explain how did it.
you can use following match:
(<a\s+href=")(.*?)(">)(.*?)(<\/a>)
and replace with:
\1\2/\4\3\4\5
Comments
Post a Comment