That is old tax law, and is no longer true.
The current law is that if you live in and own a primary residence for 2 out of the last 5 years, you can exclude up to $250,000 of gain on the sale if you are single, and up to $500,000 of gain on the sale if you are married filing a joint return.
Snipes