Search and Replace special characters |
Site Admin
|
Tabs (\t) and newlines (\n) can be found with regular expressions.
Also newlines are taken into account if multiline search option is turned on. |
||||||||||||
_________________ The PHP IDE team |
Re: Search and Replace special characters |
|
I was hoping that if I just wanted to do a quick replace to switch tabs to spaces or vice versa, I could do it without the trouble of a regular expression search. I can change the configuration to use tabs or spaces but it doesn't seem to change *existing* tabs. Bob |
||||||||||||||
|
Site Admin
|
Bob,
regexp is not something that can be called "trouble". Indeed, what trouble is in "replace \t with ' '"? From regexp's perspectives, \t is tab and it's a trivial thing. Don't you agree? But I should warn you. There is no trivial way to replace tabs with equivalent number of spaces... Let me explain a bit. Suppose we have a tab-width of 4 spaces. It means that if you have tab on the 1st (the leftmost) position, next position will be 5th (5=1+4). If there is space on the first position and tab on the 2nd, next position will be nevertheless 5th. IF there are two spaces on the 1st and 2nd positions and tab is on the 3rd, next position on right to the tab will still be 5th. It's the way tabs work. Guess, what will happen if you replace tabs with 4 spaces in those 3 cases. If on the other hand you need to replace indenting spaces with tabs, it's a kind of trivial task you can achive with Optimal Fill option turned on. When you save the file, it will reindent all the lines with minimal number of spaces and tabs (will optimize the indent). |
||||||||||||
_________________ The PHP IDE team |
|
Good point Dmitri. I tend to shy away from regexp because it never seems to do what I expect but in this case it is trivial.
My only tabs are indenting tabs and I want to go the other way (change tabs to spaces) so I think replacing each tab with 4 spaces would do it. I didn't know about Optimal Fill but I don't think it will work for changing tabs to spaces. Actually, Polystyle is probably the smart way to go here. Thanks, Bob |
||||||||||||||||
|
Search and Replace special characters |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by