This isn’t going to help much, but two thoughts. For me, looking back on my experience with miscarriage is that it’s all a bit of a blur, how people reacted. So while I’m sure people were nice and well-intentioned, I don’t even remember very distinctly what they did or didn’t say, mostly because my own emotions were so overwhelming.
Also, I briefly participated in a miscarriage support group, and it really showed me that all women were different in what they appreciated hearing from others. Some people would describe a particular response in a positive, even gushing way, and, in my head, I was horrified because I would have considered that a terrible response.
I tend to be a little more on the reserved side, so I would have been cool with a note or email that said “I was so sorry to hear your sad news, and have been thinking about you.”