I don't think it is necessary to replace them at all. All you need to do is to use the code tag. The following matrix contains tabs as separators:
The tab size in code tags is apparently 4. If you use the same tab size in your project, the result in codetags should look the same as in your editor. With different sizes the indenting will be broken, obviously.
I almost always write the code to post here in an IDE, to make sure it compiles and works as I expect. When I post a code as part of asking a question, then again the code usually comes from the IDE, so that I know it compiles and does what I ask about; doing otherwise risks wasting other members' time. So it is copy-paste job indeed.
If the code to post is really small, I sometimes do write it right there in the code tag, but then I just use spaces for indenting, no tabs. In any case I don't know how to enter tabs directly into the editor when posting on the Ranch (or any other site, actually).