38:26

וַיַּכֵּר יְהוּדָה וַיֹּאמֶר צָדְקָה מִמֶּנִּי כִּי־עַל־כֵּן לֹא־נְתַתִּיהָ לְשֵׁלָה בְנִי וְלֹא־יָסַף עוֹד לְדַעְתָּה׃

Yehudah recognised [them] and said: "She is right, it is from me. For I did not give her to my son Shelah." And he was not intimate with her again.

Bereshit 38:26

וַיַּכֵּר יְהוּדָה וַיֹּאמֶר

Bereshit / Genesis 38:26 · Sod

Bereshit 38:26

וַיַּכֵּר יְהוּדָה וַיֹּאמֶר צָדְקָה מִמֶּנִּי כִּי־עַל־כֵּן לֹא־נְתַתִּיהָ לְשֵׁלָה בְנִי וְלֹא־יָסַף עוֹד לְדַעְתָּה׃

Yehudah recognised [them] and said: "She is right, it is from me. For I did not give her to my son Shelah." And he was not intimate with her again.

Sod סוֹד

The hidden witness

Sometimes you say words, and their meaning turns out deeper than you intended. As if someone finishes the sentence for you.

Rabbeinu Bahya: when the seal, sash and staff were brought, Yehudah (Judah) confessed at once. By Ramban, she is more righteous, since she meant to fulfil the mitzvah of marrying a brother's widow. And the midrash says: a voice from heaven said "from Me". Rabbi Elazar teaches: in three places the holy spirit appeared, in the courts of Shem, Shmuel (Samuel) and Shlomo (Solomon). Yehudah said "right", and the holy spirit said "from Me".

How Rabbeinu Bahya explain it

Rabbeinu Bahya She is right, from me

When they brought him the seal, the sash and the staff, he confessed at once and said "she is right, from me", that is, right in her words, from me she is pregnant. And this is the view of the Targum.
And Ramban explained: "she is more righteous than I", for I wanted harlotry, and she wanted to fulfil the mitzvah of marrying a brother's widow. That is what he said: "for I did not give her to Shelah my son", that is, she did rightly, since I did not give her to Shelah my son, for Shelah is the dead husband's brother, and after him the duty is mine as the nearest kinsman, if he does not wish to take his brother's widow.
And in the midrash: "she is right, from me", a voice from heaven went forth and said: "From Me and through Me these things came about." And the sages expounded at the end of tractate Makkot: Rabbi Elazar said: in three places the holy spirit appeared: in the court of Shem, and in the court of Shmuel, and in the court of Shlomo. In the court of Shem: Yehudah said "right", and the holy spirit said "from Me". In the court of Shmuel, as it says: "the Eternal is witness against you, and His anointed is witness this day", "and he said: witness" (Shmuel I / I Samuel 12:5): it should have said "and they said", but the holy spirit answers: "witness". In the court of Shlomo, as it says: "give her the living child and do not kill him" (Melachim I / I Kings 3:27), and the holy spirit answers him: "she is his mother".

Takeaway

Makkot 23b: three places where "the holy spirit appeared". Each time a person says part of a sentence, and a voice from heaven finishes it.
Tamar did not name Yehudah. She said: "by the man to whom these belong" and left the choice to him. The sages learn from this: better to throw oneself into a fire than to shame another in public (Sotah 10b).
By the sages' words that Rashi brings, a voice from heaven said: for Tamar's modesty, kings will come from her.