Using $\cos^2x+\sin^2x=1$, we have
$$ (1+\sin x)(1-\sin x+\cos x)=1-\sin^2x+(1+\sin x)\cos x=\cos x(\cos x+1+\sin x).$$
Now divide the LHS by $1-\sin x+\cos x$ and the RHS by $\cos x$ to get the result.