In this paper, a financial market with Markovian switching and inflation is described, and the problem of maximizing expected utility of consumption discounted by inflation is given. Then, by a generalized Itô formula for Markov-modulated processes, the verification theorems of optimal policies are derived. Finally, the optimal consumption and portfolio policies for the constant relative risk aversion utility are given explicitly, and an economic analysis is made by numerical examples.