Can someone help me figure this one out, in an efficient manner?
Someone will be submitting text, in huge blocks, and I wish to have a function go through the text and search for either pre-defined tags or for http:// or www. and create a link out of it. Accepted formats to create a link would have to be these:
[a]link[/a] [a href]link[/a href] [ahref]link[/ahref] [link]link[/link] http://link.com www.link.com
I need to loop through the current text and turn these into links. I would hate to loop through every single time, just to check for one. Is there a quicker way, as to do one pass through the text and convert all links? I attempted this with string.Replace() but with failures (as I predicted).
The reason for this is that if a user for some reason puts in 50-100 links in a 7,000 character text block, I don't want this code to loop through it 50 - 100 times. A way around this? Please let me know.
Any and all suggestions are welcome.