The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20120315

ROTD - copying a url in the beginning of a line and pasting it into the href tag of a second a-tag (html anchor) later on in the same line

here's my regex of the day--a real, live example of how i fixed the bottom half of my music links:
http://nickleus.com/music/


i want to convert this string:
<li><a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">mp3</a> | <a href="#">01. 80sDancePopClarinet</a></li>

into this string:
<li><a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">mp3</a> | <a href="../media/audio/MiksenMaetsj/01_80sDancePopClarinet.mp3">01. 80sDancePopClarinet</a></li>

if you paste the first line, e.g. into geany, then simply use the following regex to convert it:

find:
^(.*)(\.\./media.*)(">mp3<.*href=")#(.*)$

replace with:
\1\2\3\2\4

No comments:

Post a Comment