I've been there man, only I wasn't in jail. I was put into rehab for a couple months after getting caught, losing my girlfriend of 3 years, kicked out of school and losing family trust.
Came out of rehab, started up at another school, got the girlfriend of 3 years back, regained family trust, everything. 9 months into sobriety everything was going well for me, so I decided to fuck it all up again and starting shooting dope. Again.
Got caught by my girlfriend almost in the act during my relapse. Needless to say, it was permanently over between us after that. Everything went to hell and I had to start all over. Again (didn't get kicked out of school that time though which was a major plus). What that experience taught me though was invaluable, and it was definitely the lowest I have ever felt in my entire life. I never thought I'd get over losing that girl. Never.
Been almost a year and 6 months now since I've used. Fell in love with another girl and have been with her for just over a year now. Set to graduate school next summer with a BFA in photography. Family trusts me again and I don't feel shunned when I see them.
Basically I'm telling you all this to let you know that you can be helped, and your time will come to be free of all of this when you really, truly want it to. You relapsed, that's okay, learn from it and stop if you have the will power to do so. Ask for help if you need to. Getting caught again (like I did) will be a million times worse than admitting you made a mistake, TRUST ME. You're human, humans make mistakes. It's the ones who are honest about them that are most likely to be forgiven.
I wish you the best of luck man, I really do. I know your pain. No one is beyond help, you just have to try harder than you've ever tried before, even if it means owning up to your relapse and reaching out for help. If she was meant to be, she'll still be there. If not, you'll move on. Believe me, you will. But do it now before it's too late, ending up getting caught by the law again (or worse) is the last thing you want.