22 weeks pregnant and urine infection

Claire

hi I am 22 weeks pregnant and have a urine infection. doctor prescribed macrobid. has anyone took these to treat the infection while pregnant ? Thankyou