0
votes

I have these html title tags with titles separated by some : (maybe two or three or four, or whatever), and I need to reverse their order like the following example:

<title>text1: text2: text3: text4 | sitename</title>

sometimes they are more or less : I mean more or less only text1, 2 ,3 or more than text4 separated by :

output: text4: text3: text2: text1 | sitename

P.S. I use notepad++ and I need to edit this in bulk for many files..

Thanks,

2
do you want it to be done in notepad++ or by code..?Umesh Patil
notepad++ is easier for me.. if by code, and can be done in bulk for multiple files, I am with you, but please tell me which Windows program to use and what are the steps.. thanksMike
@Mike - is this still an open issue for you or did you find a work around?Zack Macomber
thx Zack for the feedback.. still open issue.. many told me np++ doesn't do that, and I am not familiar with scripting languages and programming, so I am open for any software that could do that in bulk.. to reverse the order of whatever in the title tag in many html files, that are separated with : thanksMike
do you have Java installed on your computer? You can confirm this by opening a command prompt and typing in "java -version". If you get something back, let me know what version is listed.Zack Macomber

2 Answers

1
votes

This is possible via Notepad++ (I'm using version 6.1.2) but it's not very pretty...

Using regular expression find replace you can do the following...

Find:

<title>(.*?)?: (.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?: )?(.*?) \| (.*?)</title>

Replace:

<title>$11: $10$9$8$7$6$5$4$3$2$1 | $12</title>

BUT it comes with a warning. This assumes that your list of :textA items will never be longer than 11 instances.

0
votes

Try below in Firebug console :)

var str="text1: text2: text3: text4 | sitename";
var arr=str.split(":");
var output=" ";
for(m in arr){
  output=arr[m]+output;
}
console.log(output); // returns required output for you