Page 1 of 1

Achieving "Zero Fill" with Textpad

Posted: Sat Apr 18, 2015 10:33 pm
by no.cache
Hey everyone, I need to simulate "Zero Fill" numbering on a huge text document that has over a million lines (1,000,000), so that
^99
zero fills to
^0000099

Thanks everyone!

Posted: Sun Apr 19, 2015 3:04 pm
by MudGuard
I don't see a possibilty to do this in one go.

But you could do it in 6 steps.

Step 1: Replace ^\d{1}$ by 000000$&
Step 2: Replace ^\d{2}$ by 00000$&
...
Step 6: Replcae ^\d{6}$ by 0$&

Posted: Sun Apr 19, 2015 3:24 pm
by ben_josephs
Find what: ^(?:(\d)|(\d{2})|(\d{3})|(\d{4})|(\d{5})|(\d{6}))$
Replace with: ?1(000000$1):?2(00000$2):?3(0000$3):?4(000$4):?5(00$5):?6(0$6)
Edit: But that will only work in TextPad 7.

Posted: Fri Apr 24, 2015 3:49 pm
by no.cache
Mud, Ben . . . thanks. Doing the ZF manually can be done in minutes so that's what I'll continue to do. Just wanted to see if it was possible.