How long does hcg stay in urine?

Emily
I had what seemed like an early loss on May 8th. My period would not have been late, if anything a tad early or on time. Doc took my blood said it came back "not preg" and that it was my period (he also told me my bfp prior could have been from period hormones... Shows how much he knows) so I moved on with life. On May 17 which was 9 days after my "period" I got a bfp. Would hcg stay in urine that long and make me test positive still?? Thanks for any input, I've been going crazy!