I've been trying to do this for a while and can't figure out a way.
I am using regex in MS to clean up html files and add hyperlinks to them.
To index chapter sections in the html, I use regex to find the chapter names and write out the link.
Now when the html has more than one link named the same thing; say the html has three sections, in each section there is a chapter named "CHAPTER ONE". With regex, the script finds 3 instances of CHAPTER ONE and gives the same link to each 3 times. How to I make it so I get 3 different links.
The ms script
http://pastebin.com/m7aa566bb
The file
http://pastebin.com/m4dd12cc6
find and replace in html files
Moderators: JRL, Dorian (MJT support)
You could use the Separate> function to "find" your string. Then reassemble the html in a loop replacing your original string with a new string that somehow includes a incrementing counter.
something like this... (untested)
something like this... (untested)
Code: Select all
Separate>html,Chapter One,line
Sub>line_count,1
Let>kk=0
Let>newhtml=
Repeat>kk
Add>kk,1
Let>value=line_%kk%
Concat>newhtml,%value%Chapter One _%kk%
Until>kk=line_count
add>kk,1
Let>value=line_%kk%
Concat>newhtml,%value%