Is there any way or program to solve this kind of replacement. I have the text file which contains: <a>word1</a><b>---</b> <a>word2</a><b>---</b> <a>word3</a><b>---</b> etc... and lot of other text I want to replace first --- with word1, second --- with word2, etc Those words can be any kind of words like flower, people, beer... but the brackets (<a></a><b></b>) are the same. Is it possible to make all replacements AT ONCE? And how? The program like PowerGREP maybe could do this but I don't know how. Thanks if you can help.
Are the bold tags always going to be the next element? Is there a container you can hook those anchors off of without pissing clasess onto all the children? <div class="moveA2B"> <a>word1</a><b>---</b> <a>word1</a><b>---</b> <a>word1</a><b>---</b> <a>word1</a><b>---</b> <!-- .moveA2B --></div> Code (markup): then for the scripting: for (let anchor of document.querySelectorAll("moveA2B a") { anchor.nextElementSibling.textContent = anchor.textContent; } Code (markup): Though I would question why you'd be doing this. Moving anchor text to a sibling element seems very strange.
Since you have a text file, just about any program that massages text files will do your job with a FOR/NEXT or DO WHILE/ENDDO loop. If it were me, I would write FoxPro function with a few lines of code to do the job. Same can be done with any other language supporting text files.