Tab Insert Questions

General questions about using TextPad

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

Post Reply
sysadmin
Posts: 4
Joined: Thu Mar 09, 2006 7:51 pm

Tab Insert Questions

Post by sysadmin »

How do I insert tabs at various positions in each line of the file: 27, 36, 50, 61, 66, 72, 81, 93, 102, 110, 122

???

Thanks in advance!
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Two options.

The first is Block Select Mode. Enable that, go to those columns, highlight the entire column and hit Tab.

The second is via regular expressions. The following expression, where N is any of your numbers (27, 36, etc), could also be run.

Quote:
Find what: ^.{N-1}
Replace with: \0\t

[X] Regular expression

This assumes you are using Posix regular expression syntax:

Quote:
Configuration | Preferences | Editor

[X] Use POSIX regular expression syntax


And one of the regex gurus might offer a different route since as I think about it, that might do funny things with pre-existing tabs.
I choose to fight with a sack of angry cats.
sysadmin
Posts: 4
Joined: Thu Mar 09, 2006 7:51 pm

Post by sysadmin »

Thank you, but I don't know how to enter the sequence in find and replace: ^.{27-1},???

27, 36, 50, 61, 66, 72, 81, 93, 102, 110, 122
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Pass #1
Find what: ^.{26}
Replace with: \0\t

Pass #2
Find what: ^.{35}
Replace with: \0\t

etc

The other option would be a one pass deal

Find what: (^.{26})(.{9})(.{14})
Replace with: (\1)\t(\2)\t(\3)

Continue the above find what pattern like (.{}) where the value inside {} is the next position minus the current position, e.g. 50-36 = 14 in the above example

On the replace portion, you will add \t(\NUMBER) where NUMBER is the count of tagged search expressions. Basically, repeat the pattern (\1)\t(\2)\t(\3)\t(\4) for each set of parenthesis you have in your search expression.

The help file under regular expressions can help explain far better about what you are attempting to do.
I choose to fight with a sack of angry cats.
Post Reply