convert tabs -> space and vice versa

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Brodie

convert tabs -> space and vice versa

Post by Brodie »

Hi,

In the VC++ IDE there are 2 nice options:
* convert all sequences of spaces to tabs
* convert all tabs to sequences of spaces

Is there any option to do the same in Textpad? I can't find it myself.

Brodie.
Stephan

Re: convert tabs -> space and vice versa

Post by Stephan »

Use "Replace", activate the check box for "Regular Expressions" and search for either
" *" (without the double ticks, theses are there just to show the space) and replace it with \t - or you could search for [[:space::]]* or [[:blank:]]* to search for any number of whitespace or (tabs, spaces), if that fits more what you want to accomplish. (Probably not, since the latter two would replace, eg., two tabs by on tab - not good for source formatting...)

For more info on using Regular expressions check your help file.

Hope that helped.

Happy replacing,

Stephan
Brodie

Re: convert tabs -> space and vice versa

Post by Brodie »

Hi Stephan,

This works. I don't know why I didn't think about it earlier. I'm probably getting too used to being spoonfed.

The expressions I am after are 4 spaces to one tab and 1 tab to 4 spaces, so they are simpler than yours. eg " " -> "\t" and "\t" -> " "

Thanks
Brodie.
Anders

Re: convert tabs -> space and vice versa

Post by Anders »

How should I do to replace a sertain column of caracters, without messing araoud with the other caracters? I manage to find , for instance caracter #226, but when I like to replace only caracter #226 without messing with caracter #227?

I used a Regular Expression like this to find a certain caracter: ^\{225\}10\{22\}$ But what should i put in the "replace with" field , that won't mess with the caracters before and after the "10".
Ed

Re: convert tabs -> space and vice versa

Post by Ed »

Hi Stephan

There are some other options under Configure/preferences/Document Classes/<Class>/ Tabulation

Convert new tabs to spaces
Convert existing tabs to spaces when saving files

These options work in conjunction with Default tab spacing

Also in the top level of the class there is an option
Strip trailing spaces when saving
Ed

Re: convert tabs -> space and vice versa

Post by Ed »

Hi Anders
Your question should have been a new thread...
Have you tried selecting a column in block mode and then doing a change?

Configure/word wrap Off
Configure/Block Select mode on
Select column of interest
search and replace
smhaus_net

Re: convert tabs -> space and vice versa

Post by smhaus_net »

I wish there was a "convert spaces to tabs when saving option". Anyone else agree.
User avatar
RichPasco
Posts: 30
Joined: Wed Mar 19, 2003 12:19 am
Location: San Jose CA & Land O Lakes FL, USA
Contact:

Post by RichPasco »

Post Reply