IndentizR βητα

Original indent
convert to:


Frequently Asked Questions

This javascript tool converts of text given in by into .
Wikipedia: Indentation, Indent_style.
What is it good for?
If you got some weirdly indented source code, or if you want to change indent of your own script, this can make it.
Can it reformat source?
No, it just converts any existing indent into any other.
And that's all?
Yes. It was kinda challenge to make it :) I'm a javascript n00b. BTW, I had to make something more powerful as a "side project" to build this: The Regplax (unfinished; I have a big plans wit it).
What do these capital letters in buttons mean?
Accesskeys. Press alt (+ shift in FF2+) + that letter and you'll see.
'IndentizR'??!! OMG!
I wanted something short, unique and (erm) intuitive. I know it sound terribly, but it was nearly the only usable name I thought out.
Button 'guess'?
Planned feature.
How does it work?
Regular expression and replacement. A bit simplyfied: (\n(?:«desired indent»)*)«original indent» continuously replaced by $1«desired indent». See source or read it below.
What's your indentation habit?
One space. No, it is not a joke :) But hey, with this tool it does not matter which indent is used; you can change it with 'no risk'.
And that's why you made it?
Yes, exactly! I planned for a long time to write such tool, but the real impulse was this article.
And why not to simply do global replacement in my text editor?
Yes, in most cases it works well, but not always. Global replacement is dangerous for indentations characters/sequences which aren't actually indenting (eg. tabs in strings or simple spaces anywhere). To do it safe it is necessary to replace only characters placed at beginning of lines. To do it in the text editor, you would have to make several repeated quite complicated replacements (which this tool does by single click).
Can I contribute?
I've found a bug!
I'd like to improve...
Yey, thanks, it helped me so much!
My e-mail is: Constructive feedback, help and support welcome.

The javascript function: