简体   繁体   中英

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

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM