I writing a program in vb.net that gets data from a database generated by another program. I get the data into the string just fine. Inside the string, there are a couple urls. I'm wanting to search the string and insert html link tags (<a href=""></a>) before and after the url. I haven't been able to come up with a good way to do it. I was thinking a regular expression might do it, but I'm not sure what methods to use or exactly sure how to use it. I'm not that good with regular expressions, but this is what I have:
What I think that does is looks for a string beginning with http:// followed by any number of upper, lower, digit characters or period, underscore, percent, or dash. All of that ending with a new line. The data I'm getting starts a new line after every url, so that was the only way I knew to end the search.
I guess I'll start there and make sure reg ex's are the best way to go and make sure my reg ex is correct. Please let me know if this is the best way to do it and if my reg ex is correct.
Code:
http://[A-Za-z0-9._%-]*\n
I guess I'll start there and make sure reg ex's are the best way to go and make sure my reg ex is correct. Please let me know if this is the best way to do it and if my reg ex is correct.