Cool Anime Cool Anime - 5 months ago 27
HTML Question

notepad++ regex replace "00" with "01", "02", "03" etc

I have a file which repeats the same code, but now I would like to use Regex to replace the "00" where it is found, but increment each time.

Here is the original file:

<li onclick="tab.location.href='http://stackoverflow.com'" style="text-align: center;"><b>ep 00</b></li>

<li onclick="tab.location.href='http://stackoverflow.com/'" style="text-align: center;"><b>ep 00</b></li>

<li onclick="tab.location.href='http://stackoverflow.com/'" style="text-align: center;"><b>ep 00</b></li>


I want to use regex in notepad++ to make it like this :

<li onclick="tab.location.href='http://stackoverflow.com'" style="text-align: center;"><b>ep 00</b></li>

<li onclick="tab.location.href='http://stackoverflow.com/'" style="text-align: center;"><b>ep 01</b></li>

<li onclick="tab.location.href='http://stackoverflow.com/'" style="text-align: center;"><b>ep 02</b></li>


i want to change "ep 00" inside the tag to be ep 01, ep 02, ep 03 ... ep 711 etc ....

Thanks

Answer

as said before on the comments. Regex is not able of such task ... you can do though using a calc program ... OpenOffice Calc LibreOffice Calc BrOffice.org Calc Microsoft Office Excell you just need to something like this

or the js solution

var holderelement=document.body;
var howmanylinksyouwant=3;
for (var i=0;i<howmanylinksyouwant;i++){
var li=document.createElement("li");
li.onclick=function(){location.href="stackoverflow.com";}
li.style.textAlign="center";
li.innerHTML="<b>ep "+i+"</b>" holderelement.append(li);
}
Comments