Page 1 of 1

Find / Replace a range of characters

Posted: Fri Jul 20, 2012 4:51 pm
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

Posted: Fri Jul 20, 2012 7:20 pm
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.

Posted: Fri Jul 20, 2012 7:43 pm
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

Posted: Fri Jul 20, 2012 7:53 pm
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.

Posted: Fri Jul 20, 2012 8:19 pm
by Kelly
Thanks Ben! That worked great :)

Kelly