Find / Replace a range of characters

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

Find / Replace a range of characters

Post by Kelly »

Hi,

I have a need to delete characters between the 13th and 26th characters on each line.

Any suggestions will be very much appreciated.

Kelly
miked
Posts: 69
Joined: Tue Feb 27, 2007 11:17 am

Post by miked »

Hi,

You did say any suggestions..

I can't help with a regex if that it what you are after but I delete vertical blocks of text all the time just using block select mode.

Apologies if I'm teaching you to suck eggs but I don't know how familiar you are with textpad. Block select is double click on 'block' on the bottom status bar or hit ctrl+shift+F8. Then if it's a big file select the top left of the block and hit shift+PgDn or shift+ctrl+end etc.

Mike.
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

Post by Kelly »

Hey Mike - thanks for the reply...

I use also use block mode frequently.. so frequently that I even made an icon for it in my toolbar.

I'm looking at manipulating over two million lines and thought that I'd use that as an excuse for me to learn a little bit more on regular expressions ;)

Kelly
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Do you mean you want to remove charcters 14 to 25, inclusive? If so, try this:

Use "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Search | Replace... (<F8>):
Find what: ^(.{13}).{12}
Replace with: \1

[X] Regular expression

Replace All
Otherwise adjust the numbers as appropriate.
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

Post by Kelly »

Thanks Ben! That worked great :)

Kelly
Post Reply