Create a succession of numbers?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
terrypin
Posts: 172
Joined: Wed Jul 11, 2007 7:50 am

Create a succession of numbers?

Post by terrypin »

I have a couple of text lines:
Day 1:
Day 2:

I want to end up with say 30 lines:
Day 1:
Day 2:
Day 3:
.
.
Day 29:
Day 30:

I have a vague (probably wrong!) recollection that TextPad lets me create a succession of numbers
1
2
.
.
etc

I could then do the rest with Regex.

But darned if I can see such a numbering facility. Is there one please, or must I do that part in Excel?

Terry, East Grinstead, UK
User avatar
bbadmin
Site Admin
Posts: 948
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

The following information is taken from the TextPad Help files:

How to Generate Sequence Numbers
You can update or insert sequence numbers, using replacement format strings on the Replace dialog box, with the Regular expression option checked.

The syntax of the \i replacement format is: \i{start,increment,width,fillchar}

where start and increment are signed integers, width is an unsigned integer, and fillchar is any character, but normally space or '0'.

Without any qualifiers, \i is equivalent to \i{1,1,0, }.

Expression: Effect:
\i Replace with numbers starting from 1, incrementing by 1.
\i{10} Replace with numbers starting from 10, incrementing by 1.
\i{0,10} Replace with numbers starting from 0, incrementing by 10.
\i{100,-10} Replace with numbers starting from 100, decrementing by -10.
\i{1,1,3,0} Replace with numbers starting from 1, incrementing by 1. The numbers will be right justified in a width of 3 characters, zero filled.


Note that if more than one \i expression is used in a replacement format, they increment independently of each other.

Examples:
To insert line numbers at the start of each line:
Search for: ^
Replace with: \i
To update sequence numbers of the form Axxx, Bxxx, … ,Zxxx where "xxx" is any number >= 100, independent of the letters, which are to be preserved:
Search for: (\u)[1-9]\d{2,}
Replace with: $1\i{100}

I hope this helps.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

\i{100,-10} Replace with numbers starting from 100, decrementing by -10.
<pedantry>
    That's decrementing by 10 or incrementing by -10.
</pedantry>
terrypin
Posts: 172
Joined: Wed Jul 11, 2007 7:50 am

Post by terrypin »

"I hope this helps."

Thanks, that's exactly what I wanted. (I could have sworn my Help searches included 'number', but clearly not!)
Post Reply