I often see "replace with" and "replace by" used interchangeably, but this doesn't sound right to me:
I replaced that component by this one.
I would use "with" in such a sentence. "By" only seems reasonable in passive, although "with" sounds like it would there work too:
That component was replaced by this one.
That component was replaced with this one.
In my native language, the equivalent of "replace by" can only be used in passive, and even then it's a bit weird unless a person is the object replacing something – perhaps this affects my judgment?
Web searches haven't come up with anything conclusive; the results are contradictory and speculative at best.
Are "replace with" and "replace by" interchangeable in active context? What about passive? Are there stylistic reasons to prefer one over the other?