2 yrs should be considered the ideal interval. But few stick to this ideal. Most folks end up spending more than 2 yrs, due to comfort zone, luck factor and salary matching by existing organisation.
Also, contrary to the view, switching frequently (before 2 yrs period) doesn’t affect adversely. I know an average guy from tier 3 college, who switched so frequently that his average after 7 yrs, was 1 switch every 1.5 yrs. And he had made into one great product based company too (left that one too). He had a knack for cracking interview.
Talking of salary matching by existing organisation, no point of accepting it, since one put lots of efforts in preparing for interviews and cracking them. Also, most of the times, you decide to switch not only for package, but for various other factors- work culture, diverse tech experience etc. I would say, one should revoke the resignation, only if the offer is not only matched but also countered with 30% higher amount, and that too assuming that work culture was not the factor for the switching decision.