Looks good, but here's the tricky part...
the link is embedded in a complete text, eg.
"sdg hjgj ghd gjhsd jh gjhf <a ...>...</a> qjhsdkjhsdj hjkhj jhgjg"
It should say
"sdg hjgj ghd gjhsd jh gjhf ... (...) qjhsdkjhsdj hjkhj jhgjg"
I know I can check for the first occurence of <a, cut the link out of it, and use your solution and paste in here I lifted the other part out, but I was wondering if it's possable any other way... directly using regular expresions