Ephraim Miksha'ah, the disciple of Rabbi Meir, said in the name of Rabbi Meir: Tamar was the daughter of Shem, and it is written, "And the daughter of a priest, if she profane herself by harlotry" (Leviticus 21:9); [therefore the cry went up,] "Bring her out and let her be burned." "She was brought out" (Genesis 38:25). This teaches that [the pledges] were lost, and the Holy One, blessed be He, provided others in their place, for it is said, "she was brought out [hi mutzet]," as you say, "or has found that which was lost [matza aveidah]" (Leviticus 5:22). "She was brought out [hi mutzet]" it was stated: she and he were [both] required to go out [were both liable]. "And she sent to her father-in-law, saying" (Genesis 38:25). He sought to deny it; she said to him, "Recognize, please, your Creator, for these are yours and your Maker's" [the pledges are yours and rest in the hands of your God].
Tamar Daughter of Shem and Recognize Your Creator
Yalkut Shimoni on Torah 145:8
אֶפְרַיִם מִקְשָׁאָה תַּלְמִידוֹ שֶׁל רַבִּי מֵאִיר אָמַר בְּשֵׁם רַבִּי מֵאִיר, תָּמָר בִּתּוֹ שֶׁל שֵׁם הָיְתָה וּכְתִיב "וּבַת אִישׁ כֹּהֵן כִּי תֵחֵל לִזְנוֹת" וְגוֹ' [לְפִיכָךְ] הוֹצִיאוּהָ וְתִשָּׂרֵף. (בראשית לח כה) הִיא מוּצֵאת. מְלַמֵּד שֶׁנֶּאֶבְדוּ וְהִמְצִיא הַקָּדוֹשׁ בָּרוּךְ הוּא אֲחֵרִים תַּחְתֵּיהֶם, שֶׁנֶּאֱמַר הִיא מוּצֵאת כְּמָה דְּאַתְּ אָמַר (שם ה, כב) "אוֹ מָצָא אֲבֵדָה". הִיא מוּצֵאת אִתְּמַר הִיא וְהוּא צְרִיכִין לָצֵאת. וְהִיא שָׁלְחָה אֶל חָמִיהָ לֵאמֹר. בִּקֵּשׁ לִכְפֹּר אָמְרָה לֵיהּ, הַכֵּר לְבֹרַיִיךְ עֲלֵיהוֹן שֶׁלְּךָ וְשֶׁל בּוֹרַאֲךָ הֵם.