Shulchan Arukh, Orach Chayim Siman 220
Can copy this into an AI, or connect the whole library to your assistant. For deeper learning, you can directly use the original seforim, sites, and apps.
הרואה חלום ונפשו עגומה עליו יטיבנו באפי תלתא דרחימו ליה (פי' שאוהבים אותו) ולימא באפייהו חלמא טבא חזאי ולימרו אינהו טבא הוא וטבא להוי וכו':
Rectifying a dream and fasting about it. Contains two paragraphs. When one has a dream and is anxious about it, one can rectify the dream in front of three people who care about him. He can say to them: "I had a good dream" and they can say to him "it is a good dream and it will be well."
יפה תענית לבטל חלום רע כאש לנעורת: הגה ודוקא בו ביום ואפי' בשבת וע' לקמן סי' רפ"ח:
It is good to fast to nullify a bad dream. Like fire on wood chips. Rem"a: Specifically, this applies to the same day and even on Shabbat.