can you go to the dentist while pregnant?

I think I have a cavity. Can I get it filled while I'm pregnant?