Matthew records Joseph's reluctance to take Mary as a wife.  Mark had not recorded it because the connection to Tamar in Ge 38 was discovered during the decade between their books.
The men of the town declared that there was no harlot there.  There is no record of any man claiming to have been with Mary.
Judah's friend was an Adullamite, which means "justice of the people". He was the one who looked for the harlot but could find none. It was the Holy Ghost who examined Mary and declared it was a Holy thing within her.
No "Q" document is required for Matthew to have added these details to the record of Mark. Modern scholars expect us to believe that even though there was excellent communication and commerce throughout the Roman empire, that the NT authors were unaware of each other's writings and teachings.
If they presume that they were aware of each other, then they expect us to believe that the authors intentionally chose to contradict the writings of the others from time to time. It is more plausible that each book, written a decade or so apart, was an addendum to teach the mystery that had been revealed during the passage of that decade. The mystery was revealed through study of the word, which is why we can reproduce their teaching through a similar study.
Next: The Star
- Mt 1:19 Then Joseph her husband, being a just [man], and not willing to make her a publick example, was minded to put her away privily.
- Ge 38:23 And Judah said, Let her take [it] to her, lest we be shamed: behold, I sent this kid, and thou hast not found her.
- Mt 1:24 Then Joseph being raised from sleep did as the angel of the Lord had bidden him, and took unto him his wife: Mt 1:25 And knew her not till she had brought forth her firstborn son: and he called his name JESUS.
- Ge 38:24 ¶ And it came to pass about three months after, that it was told Judah, saying, Tamar thy daughter in law hath played the harlot; and also, behold, she [is] with child by whoredom. And Judah said, Bring her forth, and let her be burnt.
- Mt 1:19 Then Joseph her husband, being a just [man], and not willing to make her a publick example, was minded to put her away privily..
- Ge 38:21 Then he asked the men of that place, saying, Where [is] the harlot, that [was] openly by the way side? And they said, There was no harlot in this [place].
- Ge 38:26 And Judah acknowledged [them], and said, She hath been more righteous than I; because that I gave her not to Shelah my son. And he knew her again no more.
- Mt 1:20 But while he thought on these things, behold, the angel of the Lord appeared unto him in a dream, saying, Joseph, thou son of David, fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost.