For drywall, you should cut 12" past the last known wetted area. Water will not generally wick into drywall further than about 6-8". Much of that depends on the length of time the raw edge was submerged though. The extra 4"-6" is insurance. Before I would just start cutting, I would test it for moisture content. If you cleaned up rather quickly, you may have headed off the need. Compare the moisture content of the effected area to a known dry area in the same space. Some dehumidification may bring it down to a reasonbly close level and eliminate the need for demolition. You need to act fast though. Mold will set up shop in drywall in short order. Good call on the carpet. You got rid of the bulk of the moisture right there.