Halachah · Shulchan Aruch
Shulchan Arukh, Orach Chayim 220/שולחן ערוך· אורח חיים ר״כ
אהטבת החלום ותעניתו. ובו ב סעיפים:
הרואה חלום ונפשו עגומה עליו יטיבנו באפי תלתא דרחימו ליה (פי' שאוהבים אותו) ולימא באפייהו חלמא טבא חזאי ולימרו אינהו טבא הוא וטבא להוי וכו':
הרואה חלום ונפשו עגומה עליו יטיבנו באפי תלתא דרחימו ליה (פי' שאוהבים אותו) ולימא באפייהו חלמא טבא חזאי ולימרו אינהו טבא הוא וטבא להוי וכו':
1Rectifying 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."
ביפה תענית לבטל חלום רע כאש לנעורת: הגה ודוקא בו ביום ואפי' בשבת וע' לקמן סי' רפ"ח:
2It 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.