Moving text to a specific column
Posted: Mon Feb 25, 2002 8:48 pm
Hi all,
I have a table of contents that I got from another platform. The problem is is that the page numbers for the chapters, sections, etc. are appended right next to the name of the chapter, section, etc.
Now separating them wasn't a problem, I just used a regex. However that left the page numbers in a jagged vertical formation. I need to move them to a specific column, hopefully without doing it by hand, with the caveat that the chapter titles, etc. are different lengths. In other words, I can't just insert ten spaces and have them all line up that way. I need to insert ten spaces here, fifteen spaces there, two space in another place, etc.
Now I would like it if I could do this with a regex, or for that matter, a macro. But it seems that the only solution I can come up with requires Textpad's regex's and macros to be able to perform simple arithmatic. For example, if I want to align all the page numbers to the thirtieth column then I need to be able to subtract the length of the chapter title from 30 to get the number of spaces that need to be inserted (or subtracted, I almost forgot to mention that!) before the page number to get it to the correct column. Anybody got any other suggestions?
Scott J.
I have a table of contents that I got from another platform. The problem is is that the page numbers for the chapters, sections, etc. are appended right next to the name of the chapter, section, etc.
Now separating them wasn't a problem, I just used a regex. However that left the page numbers in a jagged vertical formation. I need to move them to a specific column, hopefully without doing it by hand, with the caveat that the chapter titles, etc. are different lengths. In other words, I can't just insert ten spaces and have them all line up that way. I need to insert ten spaces here, fifteen spaces there, two space in another place, etc.
Now I would like it if I could do this with a regex, or for that matter, a macro. But it seems that the only solution I can come up with requires Textpad's regex's and macros to be able to perform simple arithmatic. For example, if I want to align all the page numbers to the thirtieth column then I need to be able to subtract the length of the chapter title from 30 to get the number of spaces that need to be inserted (or subtracted, I almost forgot to mention that!) before the page number to get it to the correct column. Anybody got any other suggestions?
Scott J.