I just attempted to replace several stained pieces of carpet in my basement. I cut a piece of carpet scrap the size of the stain, being sure that the nap goes the same way on both. Then I laid the piece over the stain and used a utility knife to cut around the replacement carpet piece. Cut the carpet, not the pad underneath. After removing the stained carpeting and the scrap, I laid as many stips of carpet tape as I felt appropriate, following the directions on the box, ran a bead of carpet seam adhesive around the piece to be replaced, set it in place. To secure the carpet I walked on it, vacuumed to raise the nap and consider it finished. It matches, but is visibly a patch. I think that in time it will fit in fine, far better than the stain and I won't replace the carpet for a while.