What to say to friend who just miscarried?

Amy
I'm 20 weeks pregnant and my best girlfriend from my undergrad years also got pregnant just a couple months behind me. Even though we're long-distance now, we were thrilled to be going through this together. When I sent her a text this morning about how exciting it was to be hitting 20 weeks, she responded that she just miscarried yesterday (at 9 weeks). I'm stunned and so sad for her - I know she and her husband really wanted this baby, they already told family, etc. I guess I just don't know how to support her or what the best way to approach this is - our conversations have been so focused on pregnancy and now I don't know what I should or shouldn't say or share or if just avoiding the topic makes it even worse? I don't want to withdraw or hurt her by not sharing, but I also don't want her to feel like I'm rubbing pregnancy in her face after her loss. I just don't know what's the best way to be supportive without making her pain worse. Anyone been there (either side) and have advice?