When there are some minor issues with software and a new build is obtained after fixing the issues then instead of doing complete regression testing a sanity is performed on that build. You can say that sanity testing is a subset of regression testing.
Sanity testing is done after thorough regression testing is over, it is done to make sure that any defect fixes or changes after regression testing does not break the core functionality of the product. It is done towards the end of the product release phase.
Sanity testing follows narrow and deep approach with detailed testing of some limited features.
It is like doing some specialized testing which is used to find problems in particular functionality.
It is done with an intent to verify that end user requirements are met on not.
Sanity tests are mostly non scripted.